فهرست منبع

Don't error when love.joystick.loadGamepadMappings is given an empty string/file, since saveGamepadMappings can produce that. Resolves issue #1375.

Alex Szpakowski 7 سال پیش
والد
کامیت
53872d813a
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      src/modules/joystick/sdl/JoystickModule.cpp

+ 3 - 1
src/modules/joystick/sdl/JoystickModule.cpp

@@ -432,7 +432,9 @@ void JoystickModule::loadGamepadMappings(const std::string &mappings)
 		}
 		}
 	}
 	}
 
 
-	if (!success)
+	// Don't error when an empty string is given, since saveGamepadMappings can
+	// produce an empty string if there are no recently seen gamepads to save.
+	if (!success && !mappings.empty())
 		throw love::Exception("Invalid gamepad mappings.");
 		throw love::Exception("Invalid gamepad mappings.");
 }
 }