Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50385fc

Browse files
Fixed potential NPE
Signed-off-by: pierantoniomerlino <[email protected]>
1 parent f3bdfcc commit 50385fc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/de/taimos/gpsd4java/backend/SocketThread.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,12 @@ protected void retry() {
132132
public void halt() {
133133
this.running.set(false);
134134

135-
try {
136-
this.reader.close();
137-
} catch (final IOException e) {
138-
// ignore
135+
if (this.reader != null) {
136+
try {
137+
this.reader.close();
138+
} catch (final IOException e) {
139+
// ignore
140+
}
139141
}
140142
}
141143
}

0 commit comments

Comments
 (0)