Avoid segfault when SDL_JoystickNameForIndex returns null (no joystick for that id.)
This commit is contained in:
@@ -437,7 +437,7 @@ public:
|
|||||||
virtual void setMultitouchActive(bool inActive) { }
|
virtual void setMultitouchActive(bool inActive) { }
|
||||||
virtual bool getMultitouchActive() { return false; }
|
virtual bool getMultitouchActive() { return false; }
|
||||||
|
|
||||||
virtual const char *getJoystickName(int id) { return ""; }
|
virtual const char *getJoystickName(int id) { return NULL; }
|
||||||
|
|
||||||
Matrix GetFullMatrix(bool inStageScaling);
|
Matrix GetFullMatrix(bool inStageScaling);
|
||||||
bool FinishEditOnEnter();
|
bool FinishEditOnEnter();
|
||||||
|
|||||||
@@ -1267,7 +1267,7 @@ value lime_stage_get_joystick_name(value inStage, value inId)
|
|||||||
if (AbstractToObject(inStage,stage))
|
if (AbstractToObject(inStage,stage))
|
||||||
{
|
{
|
||||||
const char *joystickName = stage->getJoystickName(val_int(inId));
|
const char *joystickName = stage->getJoystickName(val_int(inId));
|
||||||
return alloc_string(joystickName);
|
if (joystickName != NULL) return alloc_string(joystickName);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return alloc_null();
|
return alloc_null();
|
||||||
|
|||||||
Reference in New Issue
Block a user