Permalink
Browse files

front: fix crash when default emulation profile is missing

  • Loading branch information...
1 parent 378b44d commit 20a729ed1f8357248f4fd41239f1306c21e91e5f @fzurita fzurita committed Mar 19, 2016
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/paulscode/android/mupen64plusae/persistent/GamePrefs.java
@@ -425,7 +425,7 @@ public GamePrefs( Context context, String romMd5, String crc, String headerName,
// Emulation profile
emulationProfile = loadProfile( mPreferences, EMULATION_PROFILE,
- globalPrefs.getEmulationProfileDefault(),
+ globalPrefs.getEmulationProfileDefault(), GlobalPrefs.DEFAULT_EMULATION_PROFILE_DEFAULT,
globalPrefs.GetEmulationProfilesConfig(), appData.GetEmulationProfilesConfig() );
// Touchscreen profile
@@ -436,7 +436,7 @@ public GamePrefs( Context context, String romMd5, String crc, String headerName,
else
{
touchscreenProfile = loadProfile( mPreferences, TOUCHSCREEN_PROFILE,
- globalPrefs.getTouchscreenProfileDefault(),
+ globalPrefs.getTouchscreenProfileDefault(), GlobalPrefs.DEFAULT_TOUCHSCREEN_PROFILE_DEFAULT,
globalPrefs.GetTouchscreenProfilesConfig(), appData.GetTouchscreenProfilesConfig() );
}
@@ -777,7 +777,7 @@ public static String getGameDataPath( String romMd5, String headerName, String c
}
private static Profile loadProfile( SharedPreferences prefs, String key, String defaultName,
- ConfigFile custom, ConfigFile builtin )
+ String appDefault, ConfigFile custom, ConfigFile builtin )
{
final String name = prefs.getString( key, defaultName );
@@ -791,6 +791,10 @@ else if( custom.keySet().contains( defaultName ) )
return new Profile( false, custom.get( defaultName ) );
else if( builtin.keySet().contains( defaultName ) )
return new Profile( true, builtin.get( defaultName ) );
+ else if( custom.keySet().contains( defaultName ) )
+ return new Profile( false, custom.get( appDefault ) );
+ else if( builtin.keySet().contains( defaultName ) )
+ return new Profile( true, builtin.get( appDefault ) );
else
return null;
}

0 comments on commit 20a729e

Please sign in to comment.