Fixing some server crashes caused by malformed json card definitions.

This commit is contained in:
Christian 'ketura' McCarty
2021-02-06 18:52:39 -06:00
parent a23d2ae7d1
commit da7da8b8b6
2 changed files with 8 additions and 0 deletions

View File

@@ -117,6 +117,9 @@ public class LotroCardBlueprintLibrary {
} catch (ParseException exp) {
logger.error("Failed to parse file " + file.getAbsolutePath(), exp);
}
catch (Exception exp) {
logger.error("Unexpected error while parsing file " + file.getAbsolutePath(), exp);
}
logger.debug("Loaded card file " + file.getName());
}

View File

@@ -142,6 +142,11 @@ public class SortAndFilterCards {
SetDefinition setRarity = rarities.get(blueprintId.substring(0, blueprintId.indexOf("_")));
if (setRarity != null) {
String cardRarity = setRarity.getCardRarity(library.stripBlueprintModifiers(blueprintId));
if(cardRarity == null) {
//TODO: log that the rarity was not set
//real TODO: put the rarity in the friggin json
return false;
}
for (String r : rarity) {
if (cardRarity.equals(r))
return true;