From a81f18765c119a4c11c24e121f187d61dedc6324 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 6 Aug 2023 12:45:20 +0300 Subject: [PATCH] Another workaround for another crash on Android launcher --- .../src/main/java/eu/vcmi/vcmi/util/FileUtil.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android/vcmi-app/src/main/java/eu/vcmi/vcmi/util/FileUtil.java b/android/vcmi-app/src/main/java/eu/vcmi/vcmi/util/FileUtil.java index e64dd3afa..49b731425 100644 --- a/android/vcmi-app/src/main/java/eu/vcmi/vcmi/util/FileUtil.java +++ b/android/vcmi-app/src/main/java/eu/vcmi/vcmi/util/FileUtil.java @@ -81,7 +81,7 @@ public class FileUtil { if (file == null) { - Log.e("Broken path given to fileutil"); + Log.e("Broken path given to fileutil::ensureWriteable"); return false; } @@ -99,6 +99,12 @@ public class FileUtil public static boolean clearDirectory(final File dir) { + if (dir == null) + { + Log.e("Broken path given to fileutil::clearDirectory"); + return false; + } + for (final File f : dir.listFiles()) { if (f.isDirectory() && !clearDirectory(f))