aboutsummaryrefslogtreecommitdiff
path: root/frontend/plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/plugin.c')
-rw-r--r--frontend/plugin.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/frontend/plugin.c b/frontend/plugin.c
index cf93df8..53ecac9 100644
--- a/frontend/plugin.c
+++ b/frontend/plugin.c
@@ -67,7 +67,12 @@ static long PADreadPort1(PadDataS *pad, int pad_index) {
}
static long PADreadPort2(PadDataS *pad, int pad_index) {
- pad->controllerType = in_type[pad_index];
+ /* Temporary hack to avoid segfault when pad_index is a crazy number */
+ if (pad_index <= 1 || pad_index > 8) {
+ pad_index = 1;
+ }
+
+ pad->controllerType = in_type[pad_index];
pad->buttonStatus = ~in_keystate[pad_index];
if(multitap2==1){
pad->portMultitap=2;