mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-12 21:36:21 -04:00
fix memory leak (#1986)
This commit is contained in:
parent
1b5522958a
commit
7c8d75f5a4
@ -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");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user