Fix crash on up-arrow with empty console history#44
Fix crash on up-arrow with empty console history#44
Conversation
When evalHistory is empty, pressing up-arrow set evalIndex to -1 (count - 1 = 0 - 1) then accessed evalHistory[-1], causing an out-of-range crash. Add an early return guard. Fixes cmsj#43 (partially — the other two findings are on the hs2 branch).
Greptile SummaryAdds a one-line Confidence Score: 5/5Safe to merge — single targeted fix with no side effects The change is a minimal, correct guard that addresses a confirmed crash. It only fires when evalHistory is empty, leaving all existing history-navigation behaviour untouched. handleDownArrow() is already safe for this case. No other issues found. No files require special attention Important Files Changed
Reviews (1): Last reviewed commit: "Fix crash on up-arrow with empty console..." | Re-trigger Greptile |
Summary
guard !evalHistory.isEmpty else { return .ignored }tohandleUpArrow()inConsoleView.swiftevalIndexto-1(fromcount - 1 = 0 - 1) and then accessesevalHistory[-1], crashing with array index out of rangePartially addresses #43. The other two findings (unused
styleForLogType, unusedselectedRows) exist on thehs2branch but not onmain.Test plan