Skip to content

Commit

Permalink
fix: Try fix some native image stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
IMB11 committed Jul 7, 2024
1 parent 7f1f7d0 commit b32e2d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ protected Object getTextureUniqueness() {
@Override
protected @Nullable AbstractTexture loadTexture(Runnable completionCallback) {
try (var inputStream = Files.newInputStream(getFile())) {
var image = LegacySkinConverter.processTexture(NativeImage.read(NativeImage.Format.RGBA, inputStream));

var texture = new NativeImageBackedTexture(image);

completionCallback.run();
return texture;
try (var image = LegacySkinConverter.processTexture(NativeImage.read(NativeImage.Format.RGBA, inputStream))) {
var texture = new NativeImageBackedTexture(image);
completionCallback.run();
return texture;
}
} catch (Exception e) {
SkinShuffle.LOGGER.warn("Failed to load skin from file: " + getFile(), e);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public class LegacySkinConverter {
* @return The converted image.
*/
public static NativeImage processTexture(NativeImage image) {
if (image == null) {
return image;
}

int imageHeight = image.getHeight();
int imageWidth = image.getWidth();

Expand Down

0 comments on commit b32e2d6

Please sign in to comment.