Skip to content

Commit

Permalink
Merge pull request #3 from SH1n3g4ter/main
Browse files Browse the repository at this point in the history
Fixed a bug in Nbt#fromFile where one FileInputStream was not closed correctly and remained open
  • Loading branch information
BitBuf authored Jun 29, 2022
2 parents 481863c + 7d72848 commit d98a487
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/dev/dewy/nbt/Nbt.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ public CompoundTag fromFile(@NonNull File file) throws IOException {
@Cleanup BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
@Cleanup DataInputStream in = null;

switch (CompressionType.getCompression(new FileInputStream(file))) {
@Cleanup FileInputStream fis = new FileInputStream(file);
switch (CompressionType.getCompression(fis)) {
case NONE:
in = new DataInputStream(bis);
break;
Expand Down

0 comments on commit d98a487

Please sign in to comment.