mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix to ensure invalid format files do not crash game on startup
This commit is contained in:
@@ -98,7 +98,7 @@ public abstract class StorageReaderRecursiveFolderWithUserFolder<T> extends Stor
|
|||||||
final T newDeck = this.read(file);
|
final T newDeck = this.read(file);
|
||||||
if (null == newDeck) {
|
if (null == newDeck) {
|
||||||
final String msg = "An object stored in " + file.getPath() + " failed to load.\nPlease submit this as a bug with the mentioned file/directory attached.";
|
final String msg = "An object stored in " + file.getPath() + " failed to load.\nPlease submit this as a bug with the mentioned file/directory attached.";
|
||||||
throw new RuntimeException(msg);
|
continue;//skip format completely - perhaps non format file
|
||||||
}
|
}
|
||||||
|
|
||||||
String newKey = keySelector.apply(newDeck);
|
String newKey = keySelector.apply(newDeck);
|
||||||
|
|||||||
@@ -300,7 +300,11 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
Boolean restrictedLegendary = false;
|
Boolean restrictedLegendary = false;
|
||||||
List<String> additionalCards = null; // default: nothing additional
|
List<String> additionalCards = null; // default: nothing additional
|
||||||
List<CardRarity> rarities = null;
|
List<CardRarity> rarities = null;
|
||||||
FileSection section = FileSection.parse(contents.get("format"), ":");
|
List<String> formatStrings = contents.get("format");
|
||||||
|
if (formatStrings == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
FileSection section = FileSection.parse(formatStrings, ":");
|
||||||
String title = section.get("name");
|
String title = section.get("name");
|
||||||
FormatType formatType;
|
FormatType formatType;
|
||||||
try {
|
try {
|
||||||
@@ -315,10 +319,11 @@ public class GameFormat implements Comparable<GameFormat> {
|
|||||||
formatsubType = FormatSubType.Custom;
|
formatsubType = FormatSubType.Custom;
|
||||||
}
|
}
|
||||||
Integer idx = section.getInt("order");
|
Integer idx = section.getInt("order");
|
||||||
Date date = parseDate(section.get("effectivedate"));
|
String dateStr = section.get("effectivedate");
|
||||||
if (date == null){
|
if (dateStr == null){
|
||||||
date = parseDate(DEFAULTDATE);
|
dateStr = DEFAULTDATE;
|
||||||
}
|
}
|
||||||
|
Date date = parseDate(dateStr);
|
||||||
String strSets = section.get("sets");
|
String strSets = section.get("sets");
|
||||||
if ( null != strSets ) {
|
if ( null != strSets ) {
|
||||||
sets = Arrays.asList(strSets.split(", "));
|
sets = Arrays.asList(strSets.split(", "));
|
||||||
|
|||||||
Reference in New Issue
Block a user