🐞 Fix crash when a cycle action has an empty cycle - #1115
Merged
Conversation
mrkai77
reviewed
Jul 2, 2026
`getNextCycleAction` indexes `currentCycle[0]` when restarting or when no current index is found, but only guarded against a nil `cycle`, not an empty one. A cycle action configured with zero sub-actions therefore traps (EXC_BREAKPOINT) on the empty-array subscript. Guard against an empty cycle and return the action unchanged.
bit-saver
force-pushed
the
fix/empty-cycle-crash
branch
from
August 5, 2026 17:19
3c8c319 to
5ba949c
Compare
mrkai77
approved these changes
Aug 7, 2026
Owner
|
Swiftformat errors are unrelated to this PR; merging! Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A cycle action configured with an empty cycle list crashes Loop with
EXC_BREAKPOINT(SIGTRAP) — an out-of-bounds array access.Root cause
LoopManager.getNextCycleActionguardsaction.cycleagainstnilbut not against an empty array, then doescurrentCycle[0]on the cycle-restart path and the "no current index" fallback. An empty cycle →currentCycle[0]traps.Crash (abridged):
EXC_BREAKPOINTinLoopManager.getNextCycleAction→changeAction→openLoop.Fix
Guard against an empty cycle too, returning the action unchanged (there's nothing to advance to).
Testing
Built (Release). A cycle action with zero sub-actions no longer crashes; non-empty cycles are unaffected — the guard only changes the empty case.