Return null when CurrentFocusView is not exist.
authorminho.sun <minho.sun@samsung.com>
Wed, 12 Apr 2017 10:24:58 +0000 (19:24 +0900)
committerminho.sun <minho.sun@samsung.com>
Wed, 12 Apr 2017 10:59:18 +0000 (19:59 +0900)
C# developer uses ? keyword for null check.

// Example
Tizen.Log.Error("NUI", " CurrentFocusView : " + currentFocusView?.Name);

To support this, CurrentFocusView() should return null when
there is no focused view.

Change-Id: I0806fb24fa7d9dd0626767e45cc590430f54332f
Signed-off-by: minho.sun <minho.sun@samsung.com>
src/Tizen.NUI/src/public/FocusManager.cs

index 09b7bc5..2038f3c 100755 (executable)
@@ -447,6 +447,10 @@ namespace Tizen.NUI
         {
             View ret = View.DownCast(new Actor(NDalicManualPINVOKE.FocusManager_GetCurrentFocusActor(swigCPtr), true));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            if (ret.HasBody() == false)
+            {
+                return null;
+            }
             return ret;
         }
 
@@ -534,6 +538,10 @@ namespace Tizen.NUI
         {
             View ret = View.DownCast(new Actor(NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, Actor.getCPtr(view)), true));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            if (ret.HasBody() == false)
+            {
+                return null;
+            }
             return ret;
         }
 
@@ -563,6 +571,10 @@ namespace Tizen.NUI
         {
             View ret = View.DownCast(new Actor(NDalicManualPINVOKE.FocusManager_GetFocusIndicatorActor(swigCPtr), true));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            if (ret.HasBody() == false)
+            { 
+                return null;
+            }
             return ret;
         }