[svace] add error exception when ucal is NULL 42/106942/1
authorJeesun Kim <iamjs.kim@samsung.com>
Mon, 26 Dec 2016 01:23:02 +0000 (10:23 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Mon, 26 Dec 2016 01:24:03 +0000 (10:24 +0900)
Change-Id: I250b96406cad6c9fb2f93461ac19693a1cec2833

common/cal_time.cpp

index 309976e..d940fc6 100644 (file)
@@ -86,10 +86,15 @@ UCalendar *cal_time_open_ucal(int calendar_system_type, const char *tzid, int wk
                ucal = ucal_open(utf16_timezone, -1, uloc_getDefault(), UCAL_GREGORIAN, &status);
                break;
        }
-
        if (U_FAILURE(status)) {
                /* LCOV_EXCL_START */
-               ERR("ucal_open() Fail(%s)", u_errorName(status));
+               ERR("ucal_open() Fail[%s]", u_errorName(status));
+               return NULL;
+               /* LCOV_EXCL_STOP */
+       }
+       if (NULL == ucal) {
+               /* LCOV_EXCL_START */
+               ERR("ucal_open() Fail[%s]", u_errorName(status));
                return NULL;
                /* LCOV_EXCL_STOP */
        }
@@ -97,6 +102,7 @@ UCalendar *cal_time_open_ucal(int calendar_system_type, const char *tzid, int wk
                DBG("set wkst(%d)", wkst);
                ucal_setAttribute(ucal, UCAL_FIRST_DAY_OF_WEEK, wkst);
        }
+
        return ucal;
 }