Fix dereference of null pointer when print log 79/320179/1
authorJuyeon Lee <juyeonne.lee@samsung.com>
Tue, 25 Feb 2025 03:34:21 +0000 (12:34 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Tue, 25 Feb 2025 03:41:30 +0000 (12:41 +0900)
Change-Id: I0637fbeee7595a3a877a7e7588479122e7a8b307
Signed-off-by: Juyeon Lee <juyeonne.lee@samsung.com>
manager/database/db-common.c

index 0992560f0123b49214ba2eb9696fa92b3d700158..d6947f01ec01d13b9f12eae4226fd547097b09e9 100644 (file)
@@ -49,14 +49,14 @@ static gboolean __stc_db_restore(const char *src, const char *dst)
 
        result = g_file_get_contents(src, &buf, &length, &error);
        if (result != TRUE) {
-               STC_LOGE("Failed to read [%s]", error->message);
+               STC_LOGE("Failed to read [%s]", error ? error->message : "unknown reason");
                g_error_free(error);
                return result;
        }
 
        result = g_file_set_contents(dst, buf, length, &error);
        if (result != TRUE) {
-               STC_LOGE("Failed to write [%s]", error->message);
+               STC_LOGE("Failed to write [%s]", error ? error->message : "unknown reason");
                g_error_free(error);
                g_free(buf);
                return result;