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

Skip to content

Commit 727d055

Browse files
committed
fix #32 potential NPE in stop method
1 parent 02f103d commit 727d055

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ public void start() {
148148
public void stop() {
149149

150150
try {
151-
this.socket.close();
151+
if (this.socket != null) {
152+
this.socket.close();
153+
}
152154
} catch (final IOException e1) {
153155
GPSdEndpoint.LOG.debug("Close forced: " + e1.getMessage());
154156
}

0 commit comments

Comments
 (0)