Skip to content

Commit

Permalink
Catch NullPointerException to avoid crash due to unsupported async di…
Browse files Browse the repository at this point in the history
…sconnects on Android L (which uses an outdated okhttp version)
  • Loading branch information
arthurpalves authored and danikula committed Dec 8, 2015
1 parent 0aad13f commit 33b7e5e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 33b7e5e

Please sign in to comment.