mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
We can't invoke equals method on object, that can be null, due it's lead to NPE
This commit is contained in:
parent
246469ee48
commit
51e5640c8e
1 changed files with 6 additions and 4 deletions
|
@ -3,6 +3,7 @@ package org.mage.plugins.card.utils;
|
|||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.prefs.Preferences;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.constants.Constants;
|
||||
|
@ -120,8 +121,9 @@ public class CardImageUtils {
|
|||
|
||||
public static String getImageBasePath() {
|
||||
String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true");
|
||||
String imagesPath = useDefault.equals("true") ? Constants.IO.imageBaseDir : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
|
||||
if (!imagesPath.endsWith(TFile.separator)) {
|
||||
String imagesPath = Objects.equals(useDefault, "true") ? Constants.IO.imageBaseDir : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
|
||||
|
||||
if (imagesPath != null && !imagesPath.endsWith(TFile.separator)) {
|
||||
imagesPath += TFile.separator;
|
||||
}
|
||||
return imagesPath;
|
||||
|
@ -161,7 +163,7 @@ public class CardImageUtils {
|
|||
|
||||
public static String generateImagePath(CardDownloadData card) {
|
||||
String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true");
|
||||
String imagesPath = useDefault.equals("true") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
|
||||
String imagesPath = Objects.equals(useDefault, "true") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
|
||||
|
||||
String imageDir = getImageDir(card, imagesPath);
|
||||
String imageName;
|
||||
|
@ -189,7 +191,7 @@ public class CardImageUtils {
|
|||
|
||||
public static String generateTokenDescriptorImagePath(CardDownloadData card) {
|
||||
String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true");
|
||||
String imagesPath = useDefault.equals("true") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
|
||||
String imagesPath = Objects.equals(useDefault, "true") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
|
||||
|
||||
String straightImageFile = getTokenDescriptorImagePath(card);
|
||||
TFile file = new TFile(straightImageFile);
|
||||
|
|
Loading…
Reference in a new issue