Fix Alarm exception
authorJoohyun Kim <joohyune.kim@samsung.com>
Mon, 6 May 2013 01:27:35 +0000 (10:27 +0900)
committerJoohyun Kim <joohyune.kim@samsung.com>
Mon, 6 May 2013 01:27:35 +0000 (10:27 +0900)
Change-Id: Ia98ce5e2808ac05054a4729cfab5bb1fdd950150
Signed-off-by: Joohyun Kim <joohyune.kim@samsung.com>
src/system/FSysAlarm.cpp

index c5974cf..5ba8255 100644 (file)
@@ -58,6 +58,11 @@ Alarm::Construct(IAlarmEventListener& listener)
        }
 
        r = __pAlarmImpl->SetAlarmEventListener(&listener);
+       if(r != E_SUCCESS)
+       {
+               delete __pAlarmImpl;
+               __pAlarmImpl = null;
+       }
        SysTryReturnResult(NID_SYS, !IsFailed(r), r, "Construction is failed");
 
        return E_SUCCESS;
@@ -103,18 +108,21 @@ Alarm::Cancel(void)
 const DateTime
 Alarm::GetStartTime(void) const
 {
+       SysAssertf(__pAlarmImpl != null, "Not yet constructed. Construct() should be called before use.");
        return __pAlarmImpl->GetStartTime();
 }
 
 int
 Alarm::GetPeriod(void) const
 {
+       SysAssertf(__pAlarmImpl != null, "Not yet constructed. Construct() should be called before use.");
        return __pAlarmImpl->GetPeriod();
 }
 
 const DateTime*
 Alarm::GetEndTime(void) const
 {
+       SysAssertf(__pAlarmImpl != null, "Not yet constructed. Construct() should be called before use.");
        return __pAlarmImpl->GetEndTime();
 }