From d3b2f49da3ec52bfd395999449505ae04f532e65 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 15 Sep 2019 17:53:59 +0200 Subject: [PATCH] Update GuiListViewEx() Security check in case of NULL items text provided --- src/raygui.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/raygui.h b/src/raygui.h index b917e6e..b1b18e9 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -3256,7 +3256,9 @@ RAYGUIDEF int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxVal RAYGUIDEF int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active) { int itemsCount = 0; - const char **items = GuiTextSplit(text, &itemsCount, NULL); + const char **items = NULL; + + if (text != NULL) items = GuiTextSplit(text, &itemsCount, NULL); return GuiListViewEx(bounds, items, itemsCount, NULL, scrollIndex, active); } @@ -3342,7 +3344,7 @@ RAYGUIDEF int GuiListViewEx(Rectangle bounds, const char **text, int count, int DrawRectangleLinesEx(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha)); // Draw visible items - for (int i = 0; i < visibleItems; i++) + for (int i = 0; ((i < visibleItems) && (text != NULL)); i++) { if (state == GUI_STATE_DISABLED) {