Null check for SetPrevious/Next Focus control
authorkeonpyo.kong <keonpyo.kong@samsung.com>
Mon, 25 Mar 2013 12:24:20 +0000 (21:24 +0900)
committerkeonpyo.kong <keonpyo.kong@samsung.com>
Mon, 25 Mar 2013 13:03:12 +0000 (22:03 +0900)
Change-Id: I1b2b8213171d85671116330b4133d3a5f65680a6
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
apply code review

Change-Id: I96dfbce1be207ffba38f262ec92d101dde578ffc
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
src/ui/FUiControl.cpp

index 60e5f3a..8ec997f 100644 (file)
@@ -1697,9 +1697,12 @@ Control::GetPreviousFocus(void) const
 {
        const _ControlImpl* pControlImpl = _ControlImpl::GetInstance(*this);
        SysAssertf(pControlImpl != null, "Not yet constructed. Construct() should be called before used.");
-       _ControlImpl*previousControl = pControlImpl->GetPreviousFocus();
-       return &previousControl->GetPublic();
-
+       _ControlImpl* pPreviousControl = pControlImpl->GetPreviousFocus();
+       if (pPreviousControl)
+       {
+               return &(pPreviousControl->GetPublic());
+       }
+       return null;
 }
 
 Control*
@@ -1708,9 +1711,12 @@ Control::GetNextFocus(void) const
        const _ControlImpl* pControlImpl = _ControlImpl::GetInstance(*this);
        SysAssertf(pControlImpl != null, "Not yet constructed. Construct() should be called before used.");
 
-       _ControlImpl*nextControl = pControlImpl->GetNextFocus();
-       return &nextControl->GetPublic();
-
+       _ControlImpl* pNextControl = pControlImpl->GetNextFocus();
+       if (pNextControl)
+       {
+               return &(pNextControl->GetPublic());
+       }
+       return null;
 }
 
 void