summaryrefslogtreecommitdiffstats
path: root/apps/gui/skin_engine/skin_display.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-27 11:14:23 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-28 08:42:49 -0400
commita605cdf7008f856946cbf01193f4dffc3ee63fdb (patch)
tree53368641340ffd9d10f77f56b2bde66916a1cfd1 /apps/gui/skin_engine/skin_display.c
parent621e363e70e69a92169494515c5637551ceba219 (diff)
downloadrockbox-a605cdf700.tar.gz
rockbox-a605cdf700.tar.bz2
rockbox-a605cdf700.zip
Fix multiple potential null pointer dereferencess
GCC's optimizer thinks all of these _will_ fail at some point Change-Id: I287eeb574162a5d3b3347654d25aa1f53e9f5563
Diffstat (limited to 'apps/gui/skin_engine/skin_display.c')
-rw-r--r--apps/gui/skin_engine/skin_display.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index c35b09eaac..4a3dcc2177 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -390,16 +390,20 @@ void wps_display_images(struct gui_wps *gwps, struct viewport* vp)
while (list)
{
struct wps_token *token = SKINOFFSETTOPTR(get_skin_buffer(data), list->token);
- struct gui_img *img = (struct gui_img*)SKINOFFSETTOPTR(get_skin_buffer(data), token->value.data);
- if (img->using_preloaded_icons && img->display >= 0)
- {
- screen_put_icon(display, img->x, img->y, img->display);
- }
- else if (img->loaded)
- {
- if (img->display >= 0)
+ struct gui_img *img = NULL;
+ if (token)
+ img = (struct gui_img*)SKINOFFSETTOPTR(get_skin_buffer(data), token->value.data);
+ if (img) {
+ if (img->using_preloaded_icons && img->display >= 0)
{
- wps_draw_image(gwps, img, img->display, vp);
+ screen_put_icon(display, img->x, img->y, img->display);
+ }
+ else if (img->loaded)
+ {
+ if (img->display >= 0)
+ {
+ wps_draw_image(gwps, img, img->display, vp);
+ }
}
}
list = SKINOFFSETTOPTR(get_skin_buffer(data), list->next);