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