From ffdc64bea210836e6e08352a81c049f4b969ce88 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sat, 15 Oct 2022 11:17:52 -0400 Subject: [PATCH] skin_engine fix invalid buflib handle checks buflib considers handles <= 0 as invalid skin engine was using handles < 0 Change-Id: Ie156223a43039d48ef4846fe31e6191630fa7c04 --- apps/gui/skin_engine/skin_parser.c | 3 +-- apps/gui/skin_engine/wps_internals.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index bd9a202ec7..047c4735a0 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1830,7 +1830,6 @@ abort: wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); /* Safe if skin_buffer is NULL */ wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL); wps_data->buflib_handle = core_free(wps_data->buflib_handle); - wps_data->buflib_handle = -1; #endif } @@ -1998,7 +1997,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) strcpy(path, img->bm.data); handle = load_skin_bmp(wps_data, &img->bm, bmpdir); img->buflib_handle = handle; - img->loaded = img->buflib_handle >= 0; + img->loaded = img->buflib_handle > 0; if (img->loaded) { diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index bf368bc4f3..c220480f13 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -372,7 +372,7 @@ struct wps_data #ifndef __PCTOOL__ static inline char* get_skin_buffer(struct wps_data* data) { - if (data->buflib_handle >= 0) + if (data->buflib_handle > 0) return core_get_data(data->buflib_handle); return NULL; }