diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/resource/SkinResourceManager.java b/src/hdskins/java/com/voxelmodpack/hdskins/resource/SkinResourceManager.java index 5a27d659..b5533599 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/resource/SkinResourceManager.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/resource/SkinResourceManager.java @@ -102,17 +102,23 @@ public class SkinResourceManager implements IResourceManagerReloadListener { */ private void loadSkinResource(@Nullable ResourceLocation res) { if (res != null) { - inProgress.computeIfAbsent(res, r -> CompletableFuture.supplyAsync(new ImageLoader(r), executor).whenComplete((loc, t) -> { - if (loc != null) { - converted.put(res, loc); - } else { - LogManager.getLogger().warn("Errored while processing {}. Using original.", res, t); - converted.put(res, res); - } - })); + if (!inProgress.containsKey(res)) { + inProgress.put(res, scheduleConvertion(res)); + } } } + private Future scheduleConvertion(ResourceLocation res) { + return CompletableFuture.supplyAsync(new ImageLoader(res), executor).whenComplete((result, error) -> { + if (result == null) { + result = res; + LogManager.getLogger().warn("Errored while processing {}. Using original.", res, error); + } + + converted.put(res, result); + }); + } + @Nullable private Skin getSkin(GameProfile profile) { Skin skin = uuidSkins.get(profile.getId());