Fix crash when preview image is NULL 83/74183/1 accepted/tizen/common/20160614.143656 accepted/tizen/ivi/20160614.041208 accepted/tizen/mobile/20160614.041118 accepted/tizen/tv/20160614.041154 accepted/tizen/wearable/20160614.041138 submit/tizen/20160613.062107
authorSangyoon Jang <s89.jang@samsung.com>
Mon, 13 Jun 2016 06:07:38 +0000 (15:07 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Mon, 13 Jun 2016 06:07:38 +0000 (15:07 +0900)
Change-Id: I2dcb9f19e1a194ae0e731facabffd7072b420f3a
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
parser/widget_plugin_parser_db.c

index 2af8a9a6159997c2e5406ceb10d3028804766455..88cc4dc07887e408359b460824307f2296e1de90 100644 (file)
@@ -78,12 +78,17 @@ static int _insert_support_size(sqlite3 *db, const char *pkgid,
                idx = 1;
                _bind_text(stmt, idx++, classid);
                /* adjust preview image path */
-               if (size->preview[0] == '/')
-                       snprintf(buf, sizeof(buf), "%s", size->preview);
-               else
-                       snprintf(buf, sizeof(buf), "%s/shared/res/%s",
-                                       _get_root_path(pkgid), size->preview);
-               _bind_text(stmt, idx++, buf);
+               if (size->preview != NULL) {
+                       if (size->preview[0] == '/')
+                               snprintf(buf, sizeof(buf), "%s", size->preview);
+                       else
+                               snprintf(buf, sizeof(buf), "%s/shared/res/%s",
+                                               _get_root_path(pkgid),
+                                               size->preview);
+                       _bind_text(stmt, idx++, buf);
+               } else {
+                       _bind_text(stmt, idx++, NULL);
+               }
                sqlite3_bind_int(stmt, idx++, size->frame);
                sqlite3_bind_int(stmt, idx++, size->width);
                sqlite3_bind_int(stmt, idx++, size->height);