From fd60a51a951e7b5088891dbb0684c80b33936efb Mon Sep 17 00:00:00 2001 From: bushing Date: Wed, 24 Dec 2008 07:38:39 +0000 Subject: [PATCH] Fix the degenerate case so that we don't crash if zero joypads are detected git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1645 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index c18eb5e5ce..ded466079e 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -568,16 +568,6 @@ int Search_Devices() int numjoy = SDL_NumJoysticks(); - if (numjoy == 0) - { - #ifdef _WIN32 - MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING); - #else - printf("No Joystick detected!\n"); - #endif - return 0; - } - if (joyinfo) { delete [] joyinfo; @@ -588,6 +578,16 @@ int Search_Devices() joyinfo = new CONTROLLER_INFO [numjoy]; } + if (numjoy == 0) + { + #ifdef _WIN32 + MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING); + #else + printf("No Joystick detected!\n"); + #endif + return 0; + } + #ifdef _DEBUG fprintf(pFile, "Scanning for devices\n"); fprintf(pFile, "ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\n");