From e53846d7827054116b3d8ccafac4d6769c44ef46 Mon Sep 17 00:00:00 2001 From: n00mkrad Date: Thu, 23 Feb 2023 14:14:22 +0100 Subject: [PATCH] Handle situation where interp fails without any log writes --- Code/Os/AiProcess.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Code/Os/AiProcess.cs b/Code/Os/AiProcess.cs index 607770e..03e3e01 100644 --- a/Code/Os/AiProcess.cs +++ b/Code/Os/AiProcess.cs @@ -119,9 +119,16 @@ namespace Flowframes.Os if (!Interpolate.currentSettings.ai.Piped && interpFramesCount < 3) { + string amount = interpFramesCount > 0 ? $"Only {interpFramesCount}" : "No"; + + if (lastLogName.IsEmpty()) + { + Interpolate.Cancel($"Interpolation failed - {amount} interpolated frames were created, and no log was written."); + return; + } + string[] logLines = File.ReadAllLines(Path.Combine(Paths.GetLogPath(), lastLogName + ".txt")); string log = string.Join("\n", logLines.Reverse().Take(10).Reverse().Select(x => x.Split("]: ").Last()).ToList()); - string amount = interpFramesCount > 0 ? $"Only {interpFramesCount}" : "No"; Interpolate.Cancel($"Interpolation failed - {amount} interpolated frames were created.\n\n\nLast 10 log lines:\n{log}\n\nCheck the log '{lastLogName}' for more details."); return; }