Fix memory leaks by closing streams

This commit is contained in:
Kam committed 2025-07-23 05:43:50 -04:00
1 parent 39e51bc8c2
commit 540508a2be
18 files changed
+96 -60

No files matched your search

@@ -66,7 +66,10 @@ public class TransportController implements ITransportHandler {
public void loadCategories(File file) throws IOException {
HashMap<Integer, TransportLocation> locations = new HashMap<Integer, TransportLocation>();
HashMap<Integer, TransportCategory> categories = new HashMap<Integer, TransportCategory>();
NBTTagCompound nbttagcompound1 = CompressedStreamTools.readCompressed(new FileInputStream(file));
NBTTagCompound nbttagcompound1;
try (FileInputStream fis = new FileInputStream(file)) {
nbttagcompound1 = CompressedStreamTools.readCompressed(fis);
}
lastUsedID = nbttagcompound1.getInteger("lastID");
NBTTagList list = nbttagcompound1.getTagList("NPCTransportCategories", 10);
if (list == null) {