diff --git a/src/html-url.c b/src/html-url.c
index 934a1524..98502dd9 100644
--- a/src/html-url.c
+++ b/src/html-url.c
@@ -729,8 +729,11 @@ tag_handle_img (int tagid, struct taginfo *tag, struct map_context *ctx) {
srcset + url_end);
struct urlpos *up = append_url (url_text, base_ind + url_start,
url_end - url_start, ctx);
- up->link_inline_p = 1;
- up->link_noquote_html_p = 1;
+ if (up)
+ {
+ up->link_inline_p = 1;
+ up->link_noquote_html_p = 1;
+ }
xfree (url_text);
}