OpenDelta: No NPE please

Happens very very rarely
This commit is contained in:
Ido Ben-Hur 2022-10-29 13:28:31 +03:00
parent a38d5615cc
commit 6065a6e984
No known key found for this signature in database
GPG Key ID: 0B827201D8C20BFE
1 changed files with 9 additions and 7 deletions

View File

@ -483,6 +483,7 @@ public class UpdateService extends Service implements OnNetworkStateListener,
if (latestBuild != null) {
File found = null;
File[] files = new File(mConfig.getPathBase()).listFiles();
if (files != null && files.length > 0) {
for (File file : files) {
String currName = file.getName();
if (file.isFile() && currName.endsWith(".part")) {
@ -492,6 +493,7 @@ public class UpdateService extends Service implements OnNetworkStateListener,
file.delete(); // remove old .part files
}
}
}
if (found != null) {
long total = mPrefs.getLong(PREF_DOWNLOAD_SIZE, 1500000000L /* 1.5 GB */);
final long current = found.length();