Selaa lähdekoodia

Fixed crash if SetMappingValue() is passed a NULL key

Sam Lantinga 2 vuotta sitten
vanhempi
commit
255f297439
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      test/gamepadutils.c

+ 4 - 0
test/gamepadutils.c

@@ -2463,6 +2463,10 @@ static char *SetMappingValue(char *mapping, const char *key, const char *value)
     char **new_values = NULL;
     SDL_bool result = SDL_FALSE;
 
+    if (!key) {
+        return mapping;
+    }
+
     SplitMapping(mapping, &parts);
     i = FindMappingKey(&parts, key);
     if (i >= 0) {