[NUI] IntPtr is not Null always, null should be IntPtr.Zero (#106)
authordongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 1 Feb 2018 01:45:34 +0000 (10:45 +0900)
committerGitHub <noreply@github.com>
Thu, 1 Feb 2018 01:45:34 +0000 (10:45 +0900)
src/Tizen.NUI/src/internal/Registry.cs

index fc254b8..2c0ee0a 100755 (executable)
@@ -92,36 +92,26 @@ namespace Tizen.NUI
             RefObject refObj = baseHandle.GetObjectPtr();
             IntPtr refObjectPtr = (IntPtr)RefObject.getCPtr(refObj);
 
-            if (refObjectPtr != null)
-            {
-                // we store a dictionary of ref-obects (C++ land) to managed obects (C# land)
-                return GetManagedBaseHandleFromRefObject(refObjectPtr);
-            }
-            else
-            {
-                NUILog.Error("NUI Registry RefObjectPtr is NULL!");
-                return null;
-            }
+            // we store a dictionary of ref-obects (C++ land) to managed obects (C# land)
+            return GetManagedBaseHandleFromRefObject(refObjectPtr);
         }
 
         internal static BaseHandle GetManagedBaseHandleFromNativePtr(IntPtr cPtr)
         {
             IntPtr refObjectPtr = NDalicPINVOKE.GetRefObjectPtr(cPtr);
 
-            if (refObjectPtr != null)
-            {
-                // we store a dictionary of ref-obects (C++ land) to managed obects (C# land)
-                return GetManagedBaseHandleFromRefObject(refObjectPtr);
-            }
-            else
+            // we store a dictionary of ref-obects (C++ land) to managed obects (C# land)
+            return GetManagedBaseHandleFromRefObject(refObjectPtr);
+        }
+
+        internal static BaseHandle GetManagedBaseHandleFromRefObject(IntPtr refObjectPtr)
+        {
+            if (refObjectPtr == global::System.IntPtr.Zero)
             {
                 NUILog.Error("NUI Registry RefObjectPtr is NULL!");
                 return null;
             }
-        }
 
-        internal static BaseHandle GetManagedBaseHandleFromRefObject(IntPtr refObjectPtr)
-        {
             // we store a dictionary of ref-obects (C++ land) to managed obects (C# land)
             WeakReference weakReference;