From 91aa512754233c1793c3842e793d31ae436c4a25 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Mon, 17 Aug 2009 07:16:57 +0000 Subject: fix the %xd tag parser to complain if you try to display an image it hasnt loaded yet git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22373 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_parser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'apps/gui/skin_engine/skin_parser.c') diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 20156a665c..a06cb77a34 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -486,12 +486,14 @@ static int parse_image_display(const char *wps_bufptr, /* invalid picture display tag */ return WPS_ERROR_INVALID_PARAM; } + /* sanity check */ + img = find_image(n, wps_data); + if (!img) + return WPS_ERROR_INVALID_PARAM; if ((subimage = get_image_id(wps_bufptr[1])) != -1) { - img = find_image(n, wps_data); - /* Sanity check */ - if (!img || subimage >= img->num_subimages) + if (subimage >= img->num_subimages) return WPS_ERROR_INVALID_PARAM; /* Store sub-image number to display in high bits */ -- cgit v1.2.3