Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit ac9578d

Browse files
committed
Implement #54, fixed null exception
1 parent 18670fd commit ac9578d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/com/kttdevelopment/simplehttpserver/handler/FileHandler.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,11 +671,14 @@ public final void handle(final SimpleHttpExchange exchange) throws IOException{
671671
}
672672
}else{
673673
final File file = new File(entry.getDirectory().getAbsolutePath() + "\\" + rel2);
674-
handle(exchange,file,adapter.getBytes(file, Files.readAllBytes(file.toPath()))); // use adapted now
674+
byte[] bytes = null;
675+
try{ bytes = Files.readAllBytes(file.toPath());
676+
}catch(final Exception ignored){ }
677+
handle(exchange,file,adapter.getBytes(file, bytes)); // use adapted now
675678
}
676679
}catch(final IndexOutOfBoundsException ignored){ }
677680
}
678-
handle(exchange,null,null); // not found
681+
handle(exchange,null,null); // not added to handler
679682
}
680683
exchange.close();
681684
}

0 commit comments

Comments
 (0)