Handle NULL desc in midori_bookmarks_insert_item_db

This commit is contained in:
Paweł Forysiuk 2011-02-17 20:18:18 +01:00 committed by Christian Dywan
parent 2c4015ab94
commit 74549eff9d

View file

@ -243,6 +243,7 @@ midori_bookmarks_insert_item_db (sqlite3* db,
KatzeItem* old_parent; KatzeItem* old_parent;
gchar* parent; gchar* parent;
gchar* uri; gchar* uri;
gchar* desc;
/* Bookmarks must have a name, import may produce invalid items */ /* Bookmarks must have a name, import may produce invalid items */
g_return_if_fail (katze_item_get_name (item)); g_return_if_fail (katze_item_get_name (item));
@ -252,6 +253,11 @@ midori_bookmarks_insert_item_db (sqlite3* db,
else else
uri = g_strdup (""); uri = g_strdup ("");
if (katze_item_get_text (item))
desc = g_strdup (katze_item_get_text (item));
else
desc = g_strdup ("");
/* Use folder, otherwise fallback to parent folder */ /* Use folder, otherwise fallback to parent folder */
old_parent = katze_item_get_parent (item); old_parent = katze_item_get_parent (item);
if (folder && *folder) if (folder && *folder)
@ -266,7 +272,7 @@ midori_bookmarks_insert_item_db (sqlite3* db,
" ('%q', '%q', '%q', '%q', %d, %d)", " ('%q', '%q', '%q', '%q', %d, %d)",
uri, uri,
katze_item_get_name (item), katze_item_get_name (item),
katze_item_get_text (item), desc,
parent, parent,
katze_item_get_meta_boolean (item, "toolbar"), katze_item_get_meta_boolean (item, "toolbar"),
katze_item_get_meta_boolean (item, "app")); katze_item_get_meta_boolean (item, "app"));
@ -279,6 +285,7 @@ midori_bookmarks_insert_item_db (sqlite3* db,
g_free (uri); g_free (uri);
g_free (parent); g_free (parent);
g_free (desc);
sqlite3_free (sqlcmd); sqlite3_free (sqlcmd);
} }