diff --git a/ObservatoryCore/LogMonitor.cs b/ObservatoryCore/LogMonitor.cs index 1f18a1e..44ad93f 100644 --- a/ObservatoryCore/LogMonitor.cs +++ b/ObservatoryCore/LogMonitor.cs @@ -423,10 +423,15 @@ namespace Observatory { while (IsMonitoring()) { - FileInfo fileToPoke = GetJournalFilesOrdered(journalFolder).Last(); + var journals = GetJournalFilesOrdered(journalFolder); - using FileStream stream = fileToPoke.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - stream.Close(); + if (journals.Any()) + { + FileInfo fileToPoke = GetJournalFilesOrdered(journalFolder).Last(); + + using FileStream stream = fileToPoke.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + stream.Close(); + } System.Threading.Thread.Sleep(250); } });