reader/android: add null-check to the log purging code and update vanadium-android to 0.8
Change-Id: I714dcefafbc6d5abd16409fd94d3bbcb285d6d05
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 40bd6b4..54ba5da 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -89,7 +89,7 @@
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'org.apache.commons:commons-csv:1.2'
compile 'org.apache.commons:commons-io:1.3.2'
- compile 'io.v:vanadium-android:0.5'
+ compile 'io.v:vanadium-android:0.8'
compile 'io.v:baku-toolkit:0.3.0'
// Required by baku-toolkit.
diff --git a/android/app/src/main/java/io/v/android/apps/reader/BaseReaderApplication.java b/android/app/src/main/java/io/v/android/apps/reader/BaseReaderApplication.java
index 93917ab..e9178ab 100644
--- a/android/app/src/main/java/io/v/android/apps/reader/BaseReaderApplication.java
+++ b/android/app/src/main/java/io/v/android/apps/reader/BaseReaderApplication.java
@@ -76,12 +76,18 @@
}
private void deleteOldLogs(File dir) {
- List<File> logFiles = Arrays.asList(dir.listFiles(new FilenameFilter() {
+ File[] files = dir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File file, String s) {
return s.startsWith(getLogPrefix());
}
- }));
+ });
+
+ if (files == null) {
+ return;
+ }
+
+ List<File> logFiles = Arrays.asList(files);
if (logFiles.size() >= MAX_LOG_COUNT) {
Collections.sort(logFiles);