Resolve prevent defects.
authorSungWan Kim <sw0726.kim@samsung.com>
Thu, 4 Apr 2013 04:29:24 +0000 (13:29 +0900)
committerSungWan Kim <sw0726.kim@samsung.com>
Thu, 4 Apr 2013 04:29:24 +0000 (13:29 +0900)
Change-Id: I016e0f92380a091e0ae40cdcb8a65621b26646f0
Signed-off-by: SungWan Kim <sw0726.kim@samsung.com>
src/ClEventEditorForm.cpp
src/ClEventPresentationModel.cpp

index 5244a64..43713b9 100644 (file)
@@ -653,27 +653,25 @@ EventEditorForm::OnSectionTableViewItemStateChanged(SectionTableView& tableView,
                        {
                                __pPm->SetAllDayEvent(false);
 
-                               DateTime startTime;
-                               startTime.SetValue(__pEditDateStartDate->GetYear(), __pEditDateStartDate->GetMonth(), __pEditDateStartDate->GetDay(),
-                                                                       __pEditTimeStartTime->GetHour(), __pEditTimeStartTime->GetMinute());
-                               DateTime endTime;
-                               endTime.SetValue(__pEditDateEndDate->GetYear(), __pEditDateEndDate->GetMonth(), __pEditDateEndDate->GetDay(),
-                                                               __pEditTimeEndTime->GetHour(), __pEditTimeEndTime->GetMinute());
-                               if (startTime >= endTime)
+                               if (__pEditDateStartDate != null && __pEditTimeStartTime != null
+                                       && __pEditDateEndDate != null && __pEditTimeEndTime != null)
                                {
-                                       endTime.AddHours(1);
-                               }
-                               __pPm->SetStartEndTime(startTime, endTime);
+                                       DateTime startTime;
+                                       startTime.SetValue(__pEditDateStartDate->GetYear(), __pEditDateStartDate->GetMonth(), __pEditDateStartDate->GetDay(),
+                                                                               __pEditTimeStartTime->GetHour(), __pEditTimeStartTime->GetMinute());
+                                       DateTime endTime;
+                                       endTime.SetValue(__pEditDateEndDate->GetYear(), __pEditDateEndDate->GetMonth(), __pEditDateEndDate->GetDay(),
+                                                                       __pEditTimeEndTime->GetHour(), __pEditTimeEndTime->GetMinute());
+                                       if (startTime >= endTime)
+                                       {
+                                               endTime.AddHours(1);
+                                       }
+                                       __pPm->SetStartEndTime(startTime, endTime);
 
-                               if (__pEditTimeStartTime != null)
-                               {
                                        __pEditTimeStartTime->SetTime(__pPm->GetStartTime());
                                        __pEditTimeStartTime->SetShowState(true);
                                        __pEditTimeStartTime->Invalidate(false);
-                               }
 
-                               if (__pEditTimeEndTime != null)
-                               {
                                        __pEditTimeEndTime->SetTime(__pPm->GetEndTime());
                                        __pEditTimeEndTime->SetShowState(true);
                                        __pEditTimeEndTime->Invalidate(false);
@@ -911,12 +909,6 @@ EventEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId
                                        result r = __pPm->SetEventId(eventId);
                                        if (r != E_SUCCESS)
                                        {
-                                               if (pArgs != null)
-                                               {
-                                                       pArgs->RemoveAll(true);
-                                                       delete pArgs;
-                                               }
-
                                                const String* pReturnResult = pApp->GetArgument(KEY_DATA_RETURN_RESULT);
                                                if (pReturnResult != null && pReturnResult->Equals(L"true", false) == true)
                                                {
index cb1824a..4947a29 100644 (file)
@@ -68,13 +68,18 @@ EventPresentationModel::Construct(const RecordId eventId)
        __pCalendarbook = new (std::nothrow) Calendarbook();
        __pCalendarbook->Construct();
 
-       SetEventId(eventId);
+       result r = SetEventId(eventId);
+       TryCatch(r == E_SUCCESS, , "[%s] Unable to construct EventPresentationModel.", GetErrorMessage(r));
 
        __pDateFormatter = ResourceManager::CreateDateFormatterN(Locales::DATE_TIME_STYLE_LONG);
        __pDateTimeFormatter = ResourceManager::CreateDateTimeFormatterN(Locales::DATE_TIME_STYLE_LONG);
        __pTimeFormatter = ResourceManager::CreateTimeFormatterN();
 
        return E_SUCCESS;
+CATCH:
+       delete __pCalendarbook;
+       __pCalendarbook = null;
+       return r;
 }
 
 String