From 35ba5d41d134e19d28c6a2bc7d2c8453f8d1aa76 Mon Sep 17 00:00:00 2001 From: Justin Nesselrotte Date: Sat, 3 Aug 2024 18:21:32 -0600 Subject: [PATCH] Fixed null return value from issue chooser --- app/Issues/ChoiceHelper.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Issues/ChoiceHelper.php b/app/Issues/ChoiceHelper.php index 337ad8a3..2f02fb59 100644 --- a/app/Issues/ChoiceHelper.php +++ b/app/Issues/ChoiceHelper.php @@ -28,6 +28,9 @@ public function option($name, $callback): static return $this; } + /** + * @return bool Whether the issue was fixed or not + */ public function run(): bool { if (! $this->choices->has('Cancel')) { @@ -43,6 +46,13 @@ public function run(): bool return false; } - return $this->choices->get($choiceResult)(); + $runResult = $this->choices->get($choiceResult); + if(is_null($runResult)) { + return true; // We assume a null just means it was run successfully as a lambda or something. + } else if(is_bool($runResult)) { + return $runResult; // If the option run result was a boolean, we go with that option + } + + return false; // Anything else, we assume this wasn't fixed. } }