Skip to content

Commit c35b08b

Browse files
committed
fix(tui/panels): skip profile on Get error instead of zero-value row
loadItems discarded the error from d.Profiles.Get(n) and appended a zero-value profileItem on failure. Now it skips the entry. Unreachable today (List and Get read the same in-memory map, single-threaded TUI) but removes a latent footgun if List/Get ever diverge. No test: the error path can't be triggered through the public Store API without contorting internals.
1 parent ec5cc43 commit c35b08b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal/tui/panels/profiles.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ func loadItems(d app.Deps) []list.Item {
4545
names := d.Profiles.List()
4646
items := make([]list.Item, 0, len(names))
4747
for _, n := range names {
48-
p, _ := d.Profiles.Get(n)
48+
p, err := d.Profiles.Get(n)
49+
if err != nil {
50+
// Skip rather than append a zero-value row — can't happen today
51+
// (List and Get read the same map) but guards against future drift.
52+
continue
53+
}
4954
items = append(items, profileItem{name: n, driver: p.Driver, host: p.Host})
5055
}
5156
return items

0 commit comments

Comments
 (0)