Fixed a problem with the country flag resource name causing null pointer exceptions and graphical problems on the client side.

This commit is contained in:
LevelX2 2015-06-14 14:53:23 +02:00
parent 6e2441cc42
commit 0b2e61081a
2 changed files with 2 additions and 2 deletions

View file

@ -2422,7 +2422,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"), PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"), PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"),
getUserSkipPrioritySteps(), getUserSkipPrioritySteps(),
MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png"), MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER, "true").equals("true") PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER, "true").equals("true")
); );
} }

View file

@ -68,7 +68,7 @@ public class CountryCellRenderer extends DefaultTableCellRenderer {
private ImageIcon getCountryFlagIcon(String countryCode) { private ImageIcon getCountryFlagIcon(String countryCode) {
ImageIcon flagIcon = flagIconCache.get(countryCode); ImageIcon flagIcon = flagIconCache.get(countryCode);
if (flagIcon == null) { if (flagIcon == null) {
flagIcon = new javax.swing.ImageIcon(getClass().getResource("/flags/" + countryCode +".png")); flagIcon = new javax.swing.ImageIcon(getClass().getResource("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" :".png")));
if (flagIcon.getImage() == null) { if (flagIcon.getImage() == null) {
logger.warn("Country flag resource not found: " + countryCode); logger.warn("Country flag resource not found: " + countryCode);
} else { } else {