diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/resources/SkinResourceManager.java b/src/hdskins/java/com/voxelmodpack/hdskins/resources/SkinResourceManager.java index 19f5b71e..8832ed48 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/resources/SkinResourceManager.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/resources/SkinResourceManager.java @@ -102,17 +102,21 @@ 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); - } - })); + inProgress.computeIfAbsent(res, r -> scheduleConvertion(res, r)); } } + private Future scheduleConvertion(ResourceLocation res, ResourceLocation r) { + return CompletableFuture.supplyAsync(new ImageLoader(r), 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());