Skip to content

Commit 1822d21

Browse files
committed
Fix NullPointerException when checking if storage exists
1 parent 39722a5 commit 1822d21

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/streams/io/StoredFileHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public String getTag() {
285285
}
286286

287287
public boolean existsAsFile() {
288-
if (source == null) {
288+
if (source == null || (docFile == null && ioFile == null)) {
289289
return false;
290290
}
291291

app/src/main/java/us/shandian/giga/get/DownloadMission.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ public void psContinue(boolean recover) {
664664
* @return {@code true}, if storage is invalid and cannot be used
665665
*/
666666
public boolean hasInvalidStorage() {
667-
return errCode == ERROR_PROGRESS_LOST || storage == null || storage.isInvalid() || !storage.existsAsFile();
667+
return errCode == ERROR_PROGRESS_LOST || storage == null || !storage.existsAsFile();
668668
}
669669

670670
/**

0 commit comments

Comments
 (0)