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