From 8bccf1615876f7c0ddf62c05f1b9fbc78b011b94 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 22 Nov 2012 17:40:20 +0000 Subject: Check if box with imagemap at point has area at point. --- render/html.c | 9 ++++++--- utils/nsurl.c | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/render/html.c b/render/html.c index f6e3fda56..6c6dcdfca 100644 --- a/render/html.c +++ b/render/html.c @@ -2622,9 +2622,12 @@ html_get_contextual_content(struct content *c, if (box->usemap) { const char *target = NULL; - data->link_url = nsurl_access(imagemap_get(html, - box->usemap, box_x, box_y, x, y, - &target)); + nsurl *url = imagemap_get(html, box->usemap, box_x, + box_y, x, y, &target); + /* Box might have imagemap, but no actual link area + * at point */ + if (url != NULL) + data->link_url = nsurl_access(url); } if (box->gadget) { switch (box->gadget->type) { diff --git a/utils/nsurl.c b/utils/nsurl.c index eeaf202a7..18577b65d 100644 --- a/utils/nsurl.c +++ b/utils/nsurl.c @@ -1564,9 +1564,7 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part) /* exported interface, documented in nsurl.h */ const char *nsurl_access(const nsurl *url) { - if (url == NULL) { - return NULL; - } + assert(url != NULL); return url->string; } -- cgit v1.2.3