From cc5fcfc56637b40f1b764fbe5b6e9c8418c48e43 Mon Sep 17 00:00:00 2001 From: BWiegell Date: Tue, 29 Nov 2022 23:18:28 +0100 Subject: [PATCH] fix no state crash --- AstroWall/BusinessLayer/ApplicationHandler.cs | 5 +++-- AstroWall/BusinessLayer/Logging.cs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/AstroWall/BusinessLayer/ApplicationHandler.cs b/AstroWall/BusinessLayer/ApplicationHandler.cs index c6c8634..9a4efec 100644 --- a/AstroWall/BusinessLayer/ApplicationHandler.cs +++ b/AstroWall/BusinessLayer/ApplicationHandler.cs @@ -108,6 +108,9 @@ private bool primaryInitAndCheckIfPrefsAreAvail() // Create status bar icon / menu MenuHandler.createStatusBar("Astrowall v" + Updates.currentVersion); + // Init state + State = new State(this, currentVersionStringWithCommit); + // Load prefs. If non-present halt further actions until // preft are confirmed by user Prefs = Preferences.Preferences.fromSave(); @@ -117,8 +120,6 @@ private bool primaryInitAndCheckIfPrefsAreAvail() private async Task secondaryInit(Preferences.Preferences prefsFromPostInstallPrompt) { - // Init state - State = new State(this, currentVersionStringWithCommit); // Check for updates. if (!IncorrectInstallPath) diff --git a/AstroWall/BusinessLayer/Logging.cs b/AstroWall/BusinessLayer/Logging.cs index bc44da4..2ad480a 100644 --- a/AstroWall/BusinessLayer/Logging.cs +++ b/AstroWall/BusinessLayer/Logging.cs @@ -55,8 +55,11 @@ public static Action GetLogger(string caller, bool isError = false) private void pruneLogFile() { string path = General.getLogPath(); + if (File.Exists(path)) + { long size = (new FileInfo(path)).Length; if (size > 5000000) File.Delete(path); + } } } }