summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2012-11-11 11:23:43 +0000
committerJohn-Mark Bell <jmb@netsurf-browser.org>2012-11-11 11:23:43 +0000
commitbb3a6bbb3b905287f94575fc3c65e44887b0ff58 (patch)
tree03b1b22d0a3c715ba4a3c968a41414dc4add6a2c
parentf2ab822a83537427cbc914dcc5fc575e5ddbaee7 (diff)
downloadnetsurf-bb3a6bbb3b905287f94575fc3c65e44887b0ff58.tar.gz
netsurf-bb3a6bbb3b905287f94575fc3c65e44887b0ff58.tar.bz2
Permit hotlist entries to have no title.
-rw-r--r--desktop/tree_url_node.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/desktop/tree_url_node.c b/desktop/tree_url_node.c
index 8cc3e0546..609765137 100644
--- a/desktop/tree_url_node.c
+++ b/desktop/tree_url_node.c
@@ -502,7 +502,7 @@ static void tree_url_load_entry(dom_node *li, tree_url_load_ctx *ctx)
}
derror = dom_node_get_text_content(a, &title1);
- if (derror != DOM_NO_ERR || title1 == NULL) {
+ if (derror != DOM_NO_ERR) {
warn_user("TreeLoadError", "(No title)");
dom_node_unref(a);
return;
@@ -516,18 +516,20 @@ static void tree_url_load_entry(dom_node *li, tree_url_load_ctx *ctx)
return;
}
- title = strndup(dom_string_data(title1),
- dom_string_byte_length(title1));
+ if (title1 != NULL) {
+ title = strndup(dom_string_data(title1),
+ dom_string_byte_length(title1));
+ dom_string_unref(title1);
+ } else {
+ title = strdup("");
+ }
if (title == NULL) {
warn_user("NoMemory", NULL);
dom_string_unref(url1);
- dom_string_unref(title1);
dom_node_unref(a);
return;
}
- dom_string_unref(title1);
-
/* We're loading external input.
* This may be garbage, so attempt to normalise via nsurl
*/