Skip to content

Commit

Permalink
Fixed null return value from issue chooser
Browse files Browse the repository at this point in the history
  • Loading branch information
Jnesselr committed Aug 4, 2024
1 parent de4bdba commit 35ba5d4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/Issues/ChoiceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand All @@ -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.
}
}

0 comments on commit 35ba5d4

Please sign in to comment.