From 9795bceec193599972a7dc68b825c97816b4c753 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Tue, 27 May 2025 20:36:25 +0200 Subject: [PATCH] Update error handling --- .../QuestComponents/ActiveQuestComponent.cs | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs index 7da6ae59..17580b58 100644 --- a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs +++ b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs @@ -84,31 +84,39 @@ internal sealed partial class ActiveQuestComponent ImGui.TextUnformatted(_questController.DebugState ?? string.Empty); } - QuestSequence? currentSequence = currentQuest.Quest.FindSequence(currentQuest.Sequence); - QuestStep? currentStep = currentSequence?.FindStep(currentQuest.Step); - if (!isMinimized) + try { - using (var color = new ImRaii.Color()) + QuestSequence? currentSequence = currentQuest.Quest.FindSequence(currentQuest.Sequence); + QuestStep? currentStep = currentSequence?.FindStep(currentQuest.Step); + if (!isMinimized) { - bool colored = currentStep is + using (var color = new ImRaii.Color()) { - InteractionType: EInteractionType.Instruction or EInteractionType.WaitForManualProgress - or EInteractionType.Snipe - }; - if (colored) - color.Push(ImGuiCol.Text, ImGuiColors.DalamudOrange); - - ImGui.TextUnformatted(currentStep?.Comment ?? - currentSequence?.Comment ?? currentQuest.Quest.Root.Comment ?? string.Empty); + bool colored = currentStep is + { + InteractionType: EInteractionType.Instruction or EInteractionType.WaitForManualProgress + or EInteractionType.Snipe + }; + if (colored) + color.Push(ImGuiCol.Text, ImGuiColors.DalamudOrange); + + ImGui.TextUnformatted(currentStep?.Comment ?? + currentSequence?.Comment ?? + currentQuest.Quest.Root.Comment ?? string.Empty); + } + + //var nextStep = _questController.GetNextStep(); + //ImGui.BeginDisabled(nextStep.Step == null); + ImGui.Text(_questController.ToStatString()); + //ImGui.EndDisabled(); } - //var nextStep = _questController.GetNextStep(); - //ImGui.BeginDisabled(nextStep.Step == null); - ImGui.Text(_questController.ToStatString()); - //ImGui.EndDisabled(); + DrawQuestButtons(currentQuest, currentStep, questWork, isMinimized); + } + catch (Exception e) + { + ImGui.TextColored(ImGuiColors.DalamudRed, e.ToString()); } - - DrawQuestButtons(currentQuest, currentStep, questWork, isMinimized); DrawSimulationControls(); } -- 2.20.1