Skip to content

Commit 550ce1c

Browse files
author
Stephane Landelle
committed
Fix MiscUtils: closeSilently should check for nullity, close AsyncHttpClient#662
1 parent 7d285b5 commit 550ce1c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

api/src/main/java/org/asynchttpclient/util/MiscUtils.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ public static <T> T withDefault(T value, T defaults) {
5252
}
5353

5454
public static void closeSilently(Closeable closeable) {
55-
try {
56-
closeable.close();
57-
} catch (IOException e) {
58-
}
55+
if (closeable != null)
56+
try {
57+
closeable.close();
58+
} catch (IOException e) {
59+
}
5960
}
6061
}

0 commit comments

Comments
 (0)