1
0
mirror of https://github.com/GeyserMC/PackConverter.git synced 2025-12-19 14:59:21 +00:00

Check for null when reading image (#48)

ImageIO.read may return null if it can't recognize the file type, just skip the file
This commit is contained in:
Valaphee
2025-11-09 19:37:34 +01:00
committed by GitHub
parent 544daf6396
commit 85122d1546

View File

@@ -178,6 +178,10 @@ public class TextureConverter implements AssetExtractor<Texture>, AssetConverter
byte[] bytes = textureToExport.texture().data().toByteArray();
BufferedImage image = ImageIO.read(new ByteArrayInputStream(bytes));
if (image == null) {
context.warn("Invalid texture " + texturePath + "!");
continue;
}
for (Path output : outputs) {
if (output.getParent() != null && Files.notExists(output.getParent())) {