fix memory leak (#1986)
This commit is contained in:
@@ -112,7 +112,10 @@ public class Texture {
|
|||||||
|
|
||||||
public static Texture loadTexture(InputStream in) throws IOException {
|
public static Texture loadTexture(InputStream in) throws IOException {
|
||||||
if (in == null) return null;
|
if (in == null) return null;
|
||||||
BufferedImage img = ImageIO.read(in);
|
BufferedImage img;
|
||||||
|
try (InputStream is = in) {
|
||||||
|
img = ImageIO.read(is);
|
||||||
|
}
|
||||||
if (img == null) {
|
if (img == null) {
|
||||||
throw new IIOException("No image found");
|
throw new IIOException("No image found");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user