From 68325d9da5a835c4816384e424752ecacaa28f2c Mon Sep 17 00:00:00 2001 From: Dima Krasner Date: Fri, 12 Jan 2024 12:05:33 +0200 Subject: [PATCH] fix crash on save or sub with unsupported protocol --- gplaces.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gplaces.c b/gplaces.c index e43fda3..9516017 100644 --- a/gplaces.c +++ b/gplaces.c @@ -1201,6 +1201,7 @@ static void download_to_file(const Selector *sel, URL *url, const char *def) { size_t len; int ret = 0; + if (url->proto == NULL) return; if (def != NULL && strcmp(def, "-") == 0) { stream_to_handler(sel, url, def); return; } if (def == NULL) { @@ -1264,7 +1265,7 @@ static SelectorList download_text(const Selector *sel, URL *url, int ask, int ha size_t parsed, length = 0, total = 0, prog = 0; int received, pre = 0, width, ok = 0, links = 0; - if ((c = url->proto->download(sel, url, &mime, &parser, ask)) == NULL) goto out; + if (url->proto == NULL || (c = url->proto->download(sel, url, &mime, &parser, ask)) == NULL) goto out; if (parser == NULL) { if (handle) save_and_handle(sel, url, c, mime); goto out;