Skip to content

Commit

Permalink
fix crash on save or sub with unsupported protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Jan 12, 2024
1 parent 3a710f7 commit 68325d9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gplaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 68325d9

Please sign in to comment.