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
This commit is contained in:
John Mark Bell 2011-02-21 20:56:58 +00:00
parent 7fb4e84c77
commit 66247f5b37

View File

@ -137,15 +137,19 @@ static nserror download_callback(llcache_handle *handle,
break; break;
case LLCACHE_EVENT_DONE: case LLCACHE_EVENT_DONE:
assert(ctx->window != NULL); /* There may be no associated window if there was no data or headers */
if (ctx->window != NULL)
gui_download_window_done(ctx->window); gui_download_window_done(ctx->window);
else
download_context_destroy(ctx);
break; break;
case LLCACHE_EVENT_ERROR: case LLCACHE_EVENT_ERROR:
if (ctx->window != NULL) if (ctx->window != NULL)
gui_download_window_error(ctx->window, event->data.msg); gui_download_window_error(ctx->window, event->data.msg);
else
download_context_destroy(ctx);
break; break;