[NUI] Fix View.HasFocus crash issue (#840)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Mon, 20 May 2019 06:18:23 +0000 (15:18 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 20 May 2019 06:18:23 +0000 (15:18 +0900)
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/View.cs

index 8f66348..98d7b00 100755 (executable)
@@ -2536,8 +2536,16 @@ namespace Tizen.NUI.BaseComponents
         /// <since_tizen> 3 </since_tizen>
         public bool HasFocus()
         {
-            bool ret = NDalicPINVOKE.View_HasKeyInputFocus(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            bool ret = false;
+            if (swigCPtr.Handle != global::System.IntPtr.Zero)
+            {
+                ret = NDalicPINVOKE.View_HasKeyInputFocus(swigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
+            else
+            {
+                Tizen.Log.Error("NUI", "swigCPtr of view is aleady disposed.");
+            }
             return ret;
         }