From 2f4c9ccf34a84a53d51ab69f84722d0708878d13 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Mon, 20 Feb 2023 18:20:17 -0800 Subject: [PATCH] don't crash if config file has unknown tracklist column name --- ui/widgets/tracklist.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/widgets/tracklist.go b/ui/widgets/tracklist.go index e7e0d99..d85ed56 100644 --- a/ui/widgets/tracklist.go +++ b/ui/widgets/tracklist.go @@ -106,8 +106,12 @@ func (t *Tracklist) SetVisibleColumns(cols []string) { t.hdr.SetColumnVisible(i, false) } for _, col := range cols { - t.visibleColumns[ColNumber(col)] = true - t.hdr.SetColumnVisible(ColNumber(col), true) + if num := ColNumber(col); num < 0 { + log.Printf("Unknown tracklist column %q", col) + } else { + t.visibleColumns[num] = true + t.hdr.SetColumnVisible(num, true) + } } }