summaryrefslogtreecommitdiff
path: root/desktop/download.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-02-21 20:56:58 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-02-21 20:56:58 +0000
commit66247f5b373f5de9fbaa335bf7c38303ceb79cdc (patch)
tree517205fb5683c6f5d068cc26dd932dc7a419ee34 /desktop/download.c
parent7fb4e84c7758e4fca333a996a3364799287cac00 (diff)
downloadnetsurf-66247f5b373f5de9fbaa335bf7c38303ceb79cdc.tar.gz
netsurf-66247f5b373f5de9fbaa335bf7c38303ceb79cdc.tar.bz2
Fix bug #3188376: there may be no window for a download if there were no headers or data.
Additionally, ensure we clean up on error. svn path=/trunk/netsurf/; revision=11748
Diffstat (limited to 'desktop/download.c')
-rw-r--r--desktop/download.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/desktop/download.c b/desktop/download.c
index 7ec41c37d..211bc3b37 100644
--- a/desktop/download.c
+++ b/desktop/download.c
@@ -137,15 +137,19 @@ static nserror download_callback(llcache_handle *handle,
break;
case LLCACHE_EVENT_DONE:
- assert(ctx->window != NULL);
-
- gui_download_window_done(ctx->window);
+ /* There may be no associated window if there was no data or headers */
+ if (ctx->window != NULL)
+ gui_download_window_done(ctx->window);
+ else
+ download_context_destroy(ctx);
break;
case LLCACHE_EVENT_ERROR:
if (ctx->window != NULL)
gui_download_window_error(ctx->window, event->data.msg);
+ else
+ download_context_destroy(ctx);
break;