Skip to content

Commit affadb7

Browse files
committed
possible fix for issue robaho#21, protect against NPE
1 parent 08d56b5 commit affadb7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/robaho/net/httpserver/NoSyncBufferedInputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public NoSyncBufferedInputStream(InputStream in) {
8383
private void fill() throws IOException {
8484
pos = 0;
8585
count = 0;
86-
int n = getInIfOpen().read(buf);
86+
int n = getInIfOpen().read(getBufIfOpen());
8787
if (n > 0)
8888
count = n;
8989
}

src/main/java/robaho/net/httpserver/ServerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ public void run() {
621621

622622
logger.log(Level.TRACE, () -> "exchange started "+connection.toString());
623623

624-
while (true) {
624+
while (!connection.closed) {
625625
try {
626626
runPerRequest();
627627
if (connection.closed) {

0 commit comments

Comments
 (0)