Browse Source

Fixed out of bounds axis name access

Wilson E. Alvarez 6 years ago
parent
commit
caf5e92121
1 changed files with 5 additions and 3 deletions
  1. 5 3
      main/input_default.cpp

+ 5 - 3
main/input_default.cpp

@@ -1084,7 +1084,7 @@ Array InputDefault::get_connected_joypads() {
 	return ret;
 	return ret;
 }
 }
 
 
-static const char *_buttons[] = {
+static const char *_buttons[JOY_BUTTON_MAX] = {
 	"Face Button Bottom",
 	"Face Button Bottom",
 	"Face Button Right",
 	"Face Button Right",
 	"Face Button Left",
 	"Face Button Left",
@@ -1103,7 +1103,7 @@ static const char *_buttons[] = {
 	"DPAD Right"
 	"DPAD Right"
 };
 };
 
 
-static const char *_axes[] = {
+static const char *_axes[JOY_AXIS_MAX] = {
 	"Left Stick X",
 	"Left Stick X",
 	"Left Stick Y",
 	"Left Stick Y",
 	"Right Stick X",
 	"Right Stick X",
@@ -1111,7 +1111,9 @@ static const char *_axes[] = {
 	"",
 	"",
 	"",
 	"",
 	"L2",
 	"L2",
-	"R2"
+	"R2",
+	"",
+	""
 };
 };
 
 
 String InputDefault::get_joy_button_string(int p_button) {
 String InputDefault::get_joy_button_string(int p_button) {