mirror of
https://github.com/SKCraft/Launcher.git
synced 2025-02-19 02:11:37 +01:00
Fix potential NPE with partial redownloads if connection never completes
This commit is contained in:
parent
c3b1e51a51
commit
f7bbe82dfb
@ -352,6 +352,10 @@ public class HttpRequest implements Closeable, ProgressObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Optional<PartialDownloadInfo> canRetryPartial() {
|
public Optional<PartialDownloadInfo> canRetryPartial() {
|
||||||
|
if (conn == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
if ("bytes".equals(conn.getHeaderField("Accept-Ranges"))) {
|
if ("bytes".equals(conn.getHeaderField("Accept-Ranges"))) {
|
||||||
return Optional.of(new PartialDownloadInfo(contentLength, readBytes));
|
return Optional.of(new PartialDownloadInfo(contentLength, readBytes));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user