Avoid segfault when SDL_JoystickNameForIndex returns null (no joystick for that id.)

This commit is contained in:
bendmorris
2014-02-06 16:54:54 -05:00
parent 770350fd4c
commit 94a0ba8f2f
2 changed files with 2 additions and 2 deletions

View File

@@ -1267,7 +1267,7 @@ value lime_stage_get_joystick_name(value inStage, value inId)
if (AbstractToObject(inStage,stage))
{
const char *joystickName = stage->getJoystickName(val_int(inId));
return alloc_string(joystickName);
if (joystickName != NULL) return alloc_string(joystickName);
}
#endif
return alloc_null();