diff --git a/library/src/main/java/com/danikula/videocache/HttpUrlSource.java b/library/src/main/java/com/danikula/videocache/HttpUrlSource.java index 1a39c7f..60cf31f 100644 --- a/library/src/main/java/com/danikula/videocache/HttpUrlSource.java +++ b/library/src/main/java/com/danikula/videocache/HttpUrlSource.java @@ -76,7 +76,13 @@ private int readSourceAvailableBytes(HttpURLConnection connection, int offset, i @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); + } } }