Update error handling
authorLiza Carvelli <liza@carvel.li>
Tue, 27 May 2025 18:36:25 +0000 (20:36 +0200)
committerLiza Carvelli <liza@carvel.li>
Tue, 27 May 2025 18:36:25 +0000 (20:36 +0200)
Questionable/Windows/QuestComponents/ActiveQuestComponent.cs

index 7da6ae5..17580b5 100644 (file)
@@ -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();
         }