From 69e960c109724724cfd54d26ce73ce738f5b6fa3 Mon Sep 17 00:00:00 2001 From: h3rb Date: Tue, 7 Jun 2022 01:30:18 -0400 Subject: [PATCH] Fix when setup files are not present during first run --- scripts/InputCandy/InputCandy.gml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/InputCandy/InputCandy.gml b/scripts/InputCandy/InputCandy.gml index fa15eeb..6fb748e 100644 --- a/scripts/InputCandy/InputCandy.gml +++ b/scripts/InputCandy/InputCandy.gml @@ -1,6 +1,7 @@ /* InputCandy for GMS 2.3.1+ +Tested in Runtime 2022.5.0.8 Always get the latest version from https://github.com/LAGameStudio/InputCandy See LICENSE for usage guidelines. @@ -2804,12 +2805,12 @@ function New_InputCandy_Private() { // Activate Setup applies device swapping, settings, call on "Frame 5", and only then. ActivateSetup: function() { for ( var i=0; i<__INPUTCANDY.max_players; i++ ) { - if ( !__ICI.Is_Valid_Setting(__INPUTCANDY.setup.settings[i]) ) { + if ( array_length(__INPUTCANDY.setup.settings) < (i+1) || !__ICI.Is_Valid_Setting(__INPUTCANDY.setup.settings[i]) ) { __INPUTCANDY.players[i].settings=none; - if ( !__ICI.Is_Valid_Device(__INPUTCANDY.setup.devices[i]) ) __INPUTCANDY.players[i].device=none; + if ( array_length(__INPUTCANDY.setup.devices) < (i+1) || !__ICI.Is_Valid_Device(__INPUTCANDY.setup.devices[i]) ) __INPUTCANDY.players[i].device=none; continue; } - if ( !__ICI.Is_Valid_Device(__INPUTCANDY.setup.devices[i]) ) { + if ( array_length(__INPUTCANDY.setup.devices) < (i+1) || !__ICI.Is_Valid_Device(__INPUTCANDY.setup.devices[i]) ) { __INPUTCANDY.players[i].device=none; continue; }