Skip to content

Commit bef6924

Browse files
fix(tui): prevent crash when theme filter returns no results (anomalyco#8873)
1 parent f197b8a commit bef6924

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,13 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
132132

133133
function moveTo(next: number, center = false) {
134134
setStore("selected", next)
135-
props.onMove?.(selected()!)
135+
const sel = selected()
136+
if (sel) {
137+
props.onMove?.(sel)
138+
}
136139
if (!scroll) return
137140
const target = scroll.getChildren().find((child) => {
138-
return child.id === JSON.stringify(selected()?.value)
141+
return child.id === JSON.stringify(sel?.value)
139142
})
140143
if (!target) return
141144
const y = target.y - scroll.y

0 commit comments

Comments
 (0)