Add handling Error and NULL result from system-info api 31/111331/5
authorjongmyeongko <jongmyeong.ko@samsung.com>
Fri, 20 Jan 2017 06:44:49 +0000 (15:44 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Fri, 20 Jan 2017 07:32:04 +0000 (23:32 -0800)
Change-Id: Id809e66da6124716c6c0bbf862acbeceb7799369
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/common/utils/profile_util.cc

index 2393ba6..9f90a7c 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "common/utils/profile_util.h"
 
+#include <manifest_parser/utils/logging.h>
+
 #include <system_info.h>
 
 #include <cstdlib>
@@ -18,8 +20,18 @@ TizenProfile GetTizenProfile() {
   if (__builtin_expect(profile != TizenProfile::UNKNOWN, 1))
     return profile;
 
-  system_info_get_platform_string("http://tizen.org/feature/profile",
+  int ret = system_info_get_platform_string("http://tizen.org/feature/profile",
       &profileName);
+  if (ret != SYSTEM_INFO_ERROR_NONE) {
+    LOG(ERROR) << "Can't get the profile info";
+    return profile;
+  }
+
+  if (!profileName) {
+    LOG(ERROR) << "Profile value is NULL";
+    return profile;
+  }
+
   switch (*profileName) {
     case 'm':
     case 'M':