Skip to content

Commit

Permalink
fix infinite notice for missing tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
kevlahnota committed Nov 15, 2024
1 parent bd18600 commit 4b13e55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions forge-core/src/main/java/forge/ImageKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static String getTokenImageName(String tokenKey) {
}

private static final Map<String, File> cachedCards = new HashMap<>(50000);
private static HashSet<String> missingCards = new HashSet<>();
public static HashSet<String> missingCards = new HashSet<>();
public static void clearMissingCards() {
missingCards.clear();
}
Expand Down Expand Up @@ -310,7 +310,7 @@ public static File getImageFile(String key) {
}

// System.out.println("File not found, no image created: " + key);
//add missing cards - disable for desktop version for compatibility reasons with autodownloader
// add missing cards - disable for desktop version for compatibility reasons with autodownloader
if (isLibGDXPort && !hasSetLookup(filename)) //missing cards with setlookup is handled differently
missingCards.add(filename);
return null;
Expand Down
5 changes: 5 additions & 0 deletions forge-gui/src/main/java/forge/util/ImageFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ public void fetchImage(final String imageKey, final Callback callback) {
}
if (filename.equalsIgnoreCase("null.jpg"))
return;

if (ImageKeys.missingCards.contains(filename))
return;

ImageKeys.missingCards.add(filename);
System.err.println("No specified file for '" + filename + "'.. Attempting to download from default Url");
tokenUrl = String.format("%s%s", ForgeConstants.URL_TOKEN_DOWNLOAD, filename);
}
Expand Down

0 comments on commit 4b13e55

Please sign in to comment.