From 66247f5b373f5de9fbaa335bf7c38303ceb79cdc Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 21 Feb 2011 20:56:58 +0000 Subject: 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 --- desktop/download.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'desktop') 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; -- cgit v1.2.3