Merge "[Bluetooth][OTP] Add object browsing support" into tizen submit/tizen/20170523.010304
authorPyun DoHyun <dh79.pyun@samsung.com>
Mon, 22 May 2017 02:17:39 +0000 (02:17 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 22 May 2017 02:17:39 +0000 (02:17 +0000)
bt-otp/bt-otpserver.c

index 0b7870c..9501f3e 100644 (file)
@@ -691,13 +691,15 @@ void convert_to_hex(struct object_metadata *object, char *type, char *value)
 
                localtime_r(&(object->first_created), tm);
 
-               value[1] = ((tm->tm_year+1900) >> 8) & 0xFF;
-               value[0] = (tm->tm_year+1900) & 0xFF;
-               value[2] = (tm->tm_mon+1) & 0xFF;
-               value[3] = tm->tm_mday & 0xFF;
-               value[4] = tm->tm_hour & 0xFF;
-               value[5] = tm->tm_min & 0xFF;
-               value[6] = tm->tm_sec & 0xFF;
+               if (tm) {
+                       value[1] = ((tm->tm_year+1900) >> 8) & 0xFF;
+                       value[0] = (tm->tm_year+1900) & 0xFF;
+                       value[2] = (tm->tm_mon+1) & 0xFF;
+                       value[3] = tm->tm_mday & 0xFF;
+                       value[4] = tm->tm_hour & 0xFF;
+                       value[5] = tm->tm_min & 0xFF;
+                       value[6] = tm->tm_sec & 0xFF;
+               }
 
        } else if (!g_strcmp0(type, "id")) {