From 1822d216763b92b563179e2a68c0c2bbb2020870 Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 27 Jul 2021 11:36:14 +0200 Subject: [PATCH] Fix NullPointerException when checking if storage exists --- .../java/org/schabi/newpipe/streams/io/StoredFileHelper.java | 2 +- app/src/main/java/us/shandian/giga/get/DownloadMission.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/streams/io/StoredFileHelper.java b/app/src/main/java/org/schabi/newpipe/streams/io/StoredFileHelper.java index c86164ed2..3ec648730 100644 --- a/app/src/main/java/org/schabi/newpipe/streams/io/StoredFileHelper.java +++ b/app/src/main/java/org/schabi/newpipe/streams/io/StoredFileHelper.java @@ -285,7 +285,7 @@ public class StoredFileHelper implements Serializable { } public boolean existsAsFile() { - if (source == null) { + if (source == null || (docFile == null && ioFile == null)) { return false; } diff --git a/app/src/main/java/us/shandian/giga/get/DownloadMission.java b/app/src/main/java/us/shandian/giga/get/DownloadMission.java index 628058f55..9d8eaf9a5 100644 --- a/app/src/main/java/us/shandian/giga/get/DownloadMission.java +++ b/app/src/main/java/us/shandian/giga/get/DownloadMission.java @@ -664,7 +664,7 @@ public class DownloadMission extends Mission { * @return {@code true}, if storage is invalid and cannot be used */ public boolean hasInvalidStorage() { - return errCode == ERROR_PROGRESS_LOST || storage == null || storage.isInvalid() || !storage.existsAsFile(); + return errCode == ERROR_PROGRESS_LOST || storage == null || !storage.existsAsFile(); } /**