Fixed a cross-thread UI call & possible null ref

This commit is contained in:
n00mkrad
2025-06-29 18:41:28 +02:00
parent b2f7030c33
commit f9684d1107
2 changed files with 9 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
using Flowframes.Data;
using Flowframes.IO;
using Flowframes.Ui;
using System;
using System.IO;
using System.Linq;
@@ -91,14 +92,17 @@ namespace Flowframes.Os
Logger.Log($"You are running Flowframes {installed}. The latest Patreon version is {latestPat}, the latest free version is {latestFree}.");
string gpus = OsUtils.GetGpus();
string windowTitle = "Flowframes";
if (installed.ToString() != "0.0.0")
Program.mainForm.Text = $"Flowframes {installed}";
windowTitle += $" {installed}";
else
Program.mainForm.Text = $"Flowframes [Unknown Version]";
windowTitle += $" [Unknown Version]";
if (!string.IsNullOrWhiteSpace(gpus.Trim()))
Program.mainForm.Text = $"{Program.mainForm.Text} [{gpus}]";
if (gpus.Trim().IsEmpty())
windowTitle += $"[{gpus}]";
Program.mainForm.Invoke(() => Program.mainForm.Text = windowTitle);
}
public static async Task UpdateModelList()

View File

@@ -103,7 +103,7 @@ namespace Flowframes.Ui
{
if (!progressPaused && AiProcess.processTime.IsRunning)
{
string lastLogLine = Logger.GetSessionLogLastLines(logFile, 1).Where(x => x.Contains("frame=")).LastOrDefault();
string lastLogLine = Logger.GetSessionLogLastLines(logFile, 1)?.Where(x => x.Contains("frame=")).LastOrDefault();
int num = lastLogLine == null ? 0 : lastLogLine.Split("frame=")[1].Split("fps=")[0].GetInt();
if(num > 0)