diff options
-rw-r--r-- | apps/gui/skin_engine/skin_render.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index 912763c2c1..d48dd6b5b8 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c | |||
@@ -157,21 +157,24 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info, | |||
157 | { | 157 | { |
158 | char buf[16]; | 158 | char buf[16]; |
159 | const char *out; | 159 | const char *out; |
160 | int a = TOKEN_VALUE_ONLY; | 160 | int a = img->num_subimages; |
161 | out = get_token_value(gwps, id->token, buf, sizeof(buf), &a); | 161 | out = get_token_value(gwps, id->token, buf, sizeof(buf), &a); |
162 | |||
162 | /* NOTE: get_token_value() returns values starting at 1! */ | 163 | /* NOTE: get_token_value() returns values starting at 1! */ |
163 | if (a == -1) | 164 | if (a == -1) |
164 | a = (out && *out) ? 1 : 2; | 165 | a = (out && *out) ? 1 : 2; |
165 | a--; | 166 | a--; |
166 | a += id->offset; | 167 | a += id->offset; |
168 | |||
169 | /* Clear the image, as in conditionals */ | ||
170 | clear_image_pos(gwps, img); | ||
171 | |||
167 | /* If the token returned a value which is higher than | 172 | /* If the token returned a value which is higher than |
168 | * the amount of subimages clear the image. */ | 173 | * the amount of subimages, don't draw it. */ |
169 | if (a<0 || a >= img->num_subimages) | 174 | if (a >= 0 && a < img->num_subimages) |
170 | { | 175 | { |
171 | clear_image_pos(gwps, img); | ||
172 | } | ||
173 | else | ||
174 | img->display = a; | 176 | img->display = a; |
177 | } | ||
175 | } | 178 | } |
176 | } | 179 | } |
177 | break; | 180 | break; |