Catch NullPointerException to avoid crash due to unsupported async disconnects on Android L (which uses an outdated okhttp version)

This commit is contained in:
Arthur Alves
2015-11-02 19:28:52 +02:00
committed by Alexey Danilov
parent 0aad13f118
commit 33b7e5e9d3

View File

@@ -76,7 +76,13 @@ public class HttpUrlSource implements Source {
@Override
public void close() throws ProxyCacheException {
if (connection != null) {
connection.disconnect();
try {
connection.disconnect();
} catch (NullPointerException e) {
// https://github.com/danikula/AndroidVideoCache/issues/32
// https://github.com/danikula/AndroidVideoCache/issues/29
throw new ProxyCacheException("Error disconnecting HttpUrlConnection", e);
}
}
}