Check for null in App#iconUrl.

Although I'm unsure of exactly why this is `null`, it seems sensible
that there is a possibility of null icons (e.g. for .zip files or other
media). As such, this just adds a guard condition to ensure that the
`iconUrl` is not null.

Fixes #981.
This commit is contained in:
Peter Serwylo 2017-04-25 14:27:17 +10:00
parent 6a0b16fc7d
commit 2a6dcb63bb
2 changed files with 2 additions and 3 deletions

View File

@ -279,8 +279,7 @@ public class FDroidApp extends Application {
new FileNameGenerator() {
@Override
public String generate(String imageUri) {
return imageUri.substring(
imageUri.lastIndexOf('/') + 1);
return imageUri.substring(imageUri.lastIndexOf('/') + 1);
}
},
// 30 days in secs: 30*24*60*60 = 2592000

View File

@ -531,7 +531,7 @@ class NotificationHelper {
// Need to check that the notification is still valid, and also that the image
// is indeed cached now, so we won't get stuck in an endless loop.
AppUpdateStatusManager.AppUpdateStatus oldEntry = appUpdateStatusManager.get(entry.getUniqueKey());
if (oldEntry != null && DiskCacheUtils.findInCache(oldEntry.app.iconUrl, ImageLoader.getInstance().getDiskCache()) != null) {
if (oldEntry != null && oldEntry.app != null && oldEntry.app.iconUrl != null && DiskCacheUtils.findInCache(oldEntry.app.iconUrl, ImageLoader.getInstance().getDiskCache()) != null) {
createNotification(oldEntry); // Update with new image!
}
}