Fix crash when attempting to open context menu in a browser_window with no content.

svn path=/trunk/netsurf/; revision=10143
This commit is contained in:
Chris Young 2010-03-21 19:29:33 +00:00
parent dd5370ef83
commit 48aa33f773

View File

@ -73,12 +73,13 @@ void ami_context_menu_free(void)
void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
{
struct box *curbox = gwin->bw->current_content->data.html.layout;
struct content *cc = gwin->bw->current_content;
struct box *curbox;
int box_x=0;
int box_y=0;
bool menuhascontent = false;
if(!cc) return;
if(cc->type != CONTENT_HTML) return;
if(gwin->objects[OID_MENU]) DisposeObject(gwin->objects[OID_MENU]);
@ -90,6 +91,8 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
PMA_MenuHandler, &gwin->popuphook,
TAG_DONE);
curbox = gwin->bw->current_content->data.html.layout;
while(curbox = box_at_point(curbox,x,y,&box_x,&box_y,&cc))
{
if (curbox->style && css_computed_visibility(curbox->style) == CSS_VISIBILITY_HIDDEN) continue;