From 26d107c444cd6e30a0dacf707470c6cda267d34b Mon Sep 17 00:00:00 2001 From: James Bursa Date: Wed, 25 Aug 2004 22:11:38 +0000 Subject: [project @ 2004-08-25 22:11:38 by bursa] Fix a NULL pointer read. svn path=/import/netsurf/; revision=1249 --- render/box.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'render') diff --git a/render/box.c b/render/box.c index e707e680f..64b225bce 100644 --- a/render/box.c +++ b/render/box.c @@ -2925,8 +2925,9 @@ struct box *box_object_at_point(struct content *c, int x, int y) return object_box; } + /** - * Find a box based upon its id attribute + * Find a box based upon its id attribute. * * \param box box to search * \param id id to look for @@ -2936,11 +2937,11 @@ struct box *box_find_by_id(struct box *box, const char *id) { struct box *a, *b; - if (strcmp(id, box->id) == 0) + if (box->id != NULL && strcmp(id, box->id) == 0) return box; for (a = box->children; a; a = a->next) { - if ((b = box_find_by_id(a, id)) != 0) + if ((b = box_find_by_id(a, id)) != NULL) return b; } -- cgit v1.2.3