mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Prevent crashing if quest pet images fail to load
This commit is contained in:
@@ -21,6 +21,7 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
||||
import forge.GuiBase;
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.assets.ISkinImage;
|
||||
import forge.item.PaperToken;
|
||||
import forge.properties.ForgeConstants;
|
||||
@@ -122,7 +123,19 @@ public class QuestPetController implements IQuestBazaarItem {
|
||||
public final ISkinImage getIcon(final QuestAssets qA) {
|
||||
final String path = ForgeConstants.CACHE_TOKEN_PICS_DIR;
|
||||
final int level = this.getPetLevel(qA);
|
||||
return GuiBase.getInterface().getUnskinnedIcon(path + this.levels.get(level < this.maxLevel ? level + 1 : level).getPicture() + ".jpg");
|
||||
try {
|
||||
return GuiBase.getInterface().getUnskinnedIcon(path + this.levels.get(level < this.maxLevel ? level + 1 : level).getPicture() + ".jpg");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
return GuiBase.getInterface().getUnskinnedIcon(ForgeConstants.NO_CARD_FILE);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return GuiBase.getInterface().getSkinIcon(FSkinProp.ICO_UNKNOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user