From e3541cd353a8efbfbb60d903e825e3c2c3abaa1a Mon Sep 17 00:00:00 2001 From: Calvin Hass Date: Mon, 22 Oct 2018 23:23:56 -0700 Subject: [PATCH] Fix potential crash in FontAdd() if LINUX font file doesn't exist --- src/GUIslice.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GUIslice.c b/src/GUIslice.c index c9b12faaa..3cd4afb20 100755 --- a/src/GUIslice.c +++ b/src/GUIslice.c @@ -1319,6 +1319,9 @@ bool gslc_FontAdd(gslc_tsGui* pGui,int16_t nFontId,gslc_teFontRefType eFontRefTy } else { // Fetch a font resource from the driver const void* pvFont = gslc_DrvFontAdd(eFontRefType,pvFontRef,nFontSz); + if (pvFont == NULL) { + return false; + } pGui->asFont[pGui->nFontCnt].eFontRefType = eFontRefType; pGui->asFont[pGui->nFontCnt].pvFont = pvFont;