Skip to content

Commit 626e273

Browse files
committed
Fix MiscUtils: closeSilently should check for nullity
1 parent 20bd840 commit 626e273

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/com/ning/http/util/MiscUtils.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ public static boolean getBoolean(String systemPropName, boolean defaultValue) {
4949
}
5050

5151
public static void closeSilently(Closeable closeable) {
52-
try {
53-
closeable.close();
54-
} catch (IOException e) {
52+
if(closeable != null) {
53+
try {
54+
closeable.close();
55+
} catch (IOException ioe) {
56+
// Ignored
57+
}
5558
}
5659
}
5760
}

0 commit comments

Comments
 (0)