summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-29 02:00:56 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-29 02:04:31 (EDT)
commit0e3877ab2b39507fe3cd99d4559b7d5c62aa4615 (patch)
tree709ef23ce149f10fc2faddba104d40c7ef250a05
parent941ce0a439115ff970f934a6a6ee2056c53193d9 (diff)
downloadmarquee-0e3877ab2b39507fe3cd99d4559b7d5c62aa4615.zip
marquee-0e3877ab2b39507fe3cd99d4559b7d5c62aa4615.tar.gz
marquee-0e3877ab2b39507fe3cd99d4559b7d5c62aa4615.tar.bz2
MqWebView: Use URI or "page" as save name if title is NULL
Fixes: (marquee:xxxxx): GLib-CRITICAL **: g_strdelimit: assertion 'string != NULL' failed (marquee:xxxxx): Gtk-CRITICAL **: gtk_file_chooser_set_current_name: assertion 'name != NULL' failed
-rw-r--r--src/web-view.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/web-view.c b/src/web-view.c
index 8acb939..c6ff0ad 100644
--- a/src/web-view.c
+++ b/src/web-view.c
@@ -965,10 +965,16 @@ save_mhtml(MqWebView *web_view, GFile *file)
static gchar *
get_clean_title(MqWebView *web_view)
{
- gchar *title;
+ const gchar *title;
- title = g_strdup(webkit_web_view_get_title(WEBKIT_WEB_VIEW(web_view)));
- return g_strdelimit(title,
+ title = webkit_web_view_get_title(WEBKIT_WEB_VIEW(web_view));
+ if (!title || title[0] == '\0') {
+ title = web_view->uri;
+ }
+ if (!title || title[0] == '\0') {
+ title = "page";
+ }
+ return g_strdelimit(g_strdup(title),
#ifdef G_OS_WIN32
"/\\:*\"?<>|",
#else