Avoid failing completely if gui_window is NULL

svn path=/trunk/netsurf/; revision=10194
This commit is contained in:
Chris Young 2010-03-28 21:40:22 +00:00
parent aafc98465b
commit c2f9c06de3

View File

@ -62,11 +62,9 @@ struct gui_download_window *gui_download_window_create(const char *url,
struct gui_download_window *dw;
APTR va[3];
if(!gui) return NULL;
dw = AllocVec(sizeof(struct gui_download_window),MEMF_PRIVATE | MEMF_CLEAR);
if((!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url)))
if(gui && (!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url)))
{
strcpy(dw->fname, dw->dln->filename);
free(dw->dln->node.ln_Name);
@ -77,6 +75,7 @@ struct gui_download_window *gui_download_window_create(const char *url,
if(AslRequestTags(savereq,
ASLFR_TitleText,messages_get("NetSurf"),
ASLFR_Screen,scrn,
ASLFR_InitialDrawer, option_download_dir,
ASLFR_InitialFile,FilePart(url),
TAG_DONE))
{
@ -88,7 +87,7 @@ struct gui_download_window *gui_download_window_create(const char *url,
dw->size = total_size;
dw->downloaded = 0;
dw->bw = gui->shared->bw;
if(gui) dw->bw = gui->shared->bw;
dw->url = (char *)strdup((char *)url);
va[0] = (APTR)dw->downloaded;