Explorar o código

Prevent crash when passing NULL to GuiToggleSlider (#437)

Antonis Geralis hai 9 meses
pai
achega
d0cbf9bee2
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/raygui.h

+ 3 - 1
src/raygui.h

@@ -2149,7 +2149,9 @@ int GuiToggleSlider(Rectangle bounds, const char *text, int *active)
 
 
     // Get substrings items from text (items pointers)
     // Get substrings items from text (items pointers)
     int itemCount = 0;
     int itemCount = 0;
-    const char **items = GuiTextSplit(text, ';', &itemCount, NULL);
+    const char **items = NULL;
+
+    if (text != NULL) items = GuiTextSplit(text, ';', &itemCount, NULL);    
 
 
     Rectangle slider = {
     Rectangle slider = {
         0,      // Calculated later depending on the active toggle
         0,      // Calculated later depending on the active toggle