From d189a096e383cb4397d0865f8bfc024d041e51cd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 23 Sep 2024 21:45:28 +0200 Subject: [PATCH] SongPage: fix assert() checking the "tag" range AppendTag() is called with a mpd_tag_type, and therefore it should be in that range. The assert() has always been wrong, but that had no effect until commit f64f11623b763f6da5591b5fd11e88223f647621 Closes https://github.com/MusicPlayerDaemon/ncmpc/issues/149 --- NEWS | 1 + src/SongPage.cxx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 76821ddd..16bae935 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ ncmpc 0.51 - not yet released * repaint main area after terminal was resized * pressing Enter while in "jump mode" activates selected item * fix crash in new text input dialog +* fix crash on song info page ncmpc 0.50 - (2024-09-12) * build: require Meson 0.60 diff --git a/src/SongPage.cxx b/src/SongPage.cxx index d5df3ea1..b1bf184e 100644 --- a/src/SongPage.cxx +++ b/src/SongPage.cxx @@ -289,7 +289,7 @@ SongPage::AppendTag(const struct mpd_song *song, unsigned i = 0; const char *value; - assert((unsigned)tag < std::size(tag_labels)); + assert(tag < MPD_TAG_COUNT); assert(label != nullptr); while ((value = mpd_song_get_tag(song, tag, i++)) != nullptr)