From c3bc6ce84f3db316b7999d420a863dd1a86bbb6f Mon Sep 17 00:00:00 2001 From: "keonpyo.kong" Date: Mon, 25 Mar 2013 21:24:20 +0900 Subject: [PATCH] Null check for SetPrevious/Next Focus control Change-Id: I1b2b8213171d85671116330b4133d3a5f65680a6 Signed-off-by: keonpyo.kong apply code review Change-Id: I96dfbce1be207ffba38f262ec92d101dde578ffc Signed-off-by: keonpyo.kong --- src/ui/FUiControl.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ui/FUiControl.cpp b/src/ui/FUiControl.cpp index 60e5f3a..8ec997f 100644 --- a/src/ui/FUiControl.cpp +++ b/src/ui/FUiControl.cpp @@ -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 -- 2.7.4