fix fallback texture reading

This commit is contained in:
Bixilon 2022-09-03 23:15:27 +02:00
parent a218082a37
commit bd5094c609
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -102,7 +102,6 @@ object OpenGLTextureUtil {
} }
private fun InputStream.readFallbackTexture(): Pair<Vec2i, ByteBuffer> { private fun InputStream.readFallbackTexture(): Pair<Vec2i, ByteBuffer> {
// ToDo: This somehow crashes with some resource packs
val image: BufferedImage = ImageIO.read(this) val image: BufferedImage = ImageIO.read(this)
val rgb = image.getRGB(0, 0, image.width, image.height, null, 0, image.width) val rgb = image.getRGB(0, 0, image.width, image.height, null, 0, image.width)
@ -126,6 +125,7 @@ object OpenGLTextureUtil {
Pair(Vec2i(decoder.width, decoder.height), data) Pair(Vec2i(decoder.width, decoder.height), data)
} catch (exception: Throwable) { } catch (exception: Throwable) {
this.reset()
readFallbackTexture() readFallbackTexture()
} }
} }