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,13 +483,15 @@ public class UpdateService extends Service implements OnNetworkStateListener,
if (latestBuild != null) {
File found = null;
File[] files = new File(mConfig.getPathBase()).listFiles();
for (File file : files) {
String currName = file.getName();
if (file.isFile() && currName.endsWith(".part")) {
if (currName.equals(latestBuild + ".part"))
found = file;
else
file.delete(); // remove old .part files
if (files != null && files.length > 0) {
for (File file : files) {
String currName = file.getName();
if (file.isFile() && currName.endsWith(".part")) {
if (currName.equals(latestBuild + ".part"))
found = file;
else
file.delete(); // remove old .part files
}
}
}
if (found != null) {