From 10cdd9e682868b12d466e40b11c755070c94790b Mon Sep 17 00:00:00 2001 From: Roberto Viola Date: Tue, 25 Jun 2024 12:42:17 +0200 Subject: [PATCH] fixing crash --- app/build.gradle | 2 +- .../main/java/org/cagnulein/android_remote/FileLogger.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 690a87d..762754f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ android { applicationId "org.cagnulein.android_remote" minSdkVersion 29 targetSdkVersion 32 - versionCode 13 + versionCode 14 versionName "2.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" setProperty("archivesBaseName", "android_remote") diff --git a/app/src/main/java/org/cagnulein/android_remote/FileLogger.java b/app/src/main/java/org/cagnulein/android_remote/FileLogger.java index 95ecc18..a252bc2 100644 --- a/app/src/main/java/org/cagnulein/android_remote/FileLogger.java +++ b/app/src/main/java/org/cagnulein/android_remote/FileLogger.java @@ -36,8 +36,10 @@ public void log(Level level, String msg) { super.log(level, msg); if(true/*debuglog*/) { try { - writer.write(String.format("[%s] %s: %s%n", java.time.LocalDateTime.now(), level, msg)); - writer.flush(); + if(writer != null) { + writer.write(String.format("[%s] %s: %s%n", java.time.LocalDateTime.now(), level, msg)); + writer.flush(); + } } catch (IOException e) { e.printStackTrace(); }