From cf2d171cccfbc5627ce9957cc8dd63272a16e0d3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 20 Feb 2019 21:24:01 +0100 Subject: [PATCH] db/simple: reorder checks in assert() to fix assertion failure `light_song.Get()` could cause an assertion failure because the `Manual<>` object must not be used if uninitialized. Regression by commit ebc006ab529169d3d067231863ab7fc52fd9c49a --- NEWS | 2 ++ src/db/plugins/simple/SimpleDatabasePlugin.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 3faed0de3..40cfa264a 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ ver 0.21.5 (not yet released) * protocol - fix deadlock in "albumart" command - fix "tagtypes disable" command +* database + - simple: fix assertion failure * input - buffer: fix crash bug when playing remote WAV file * tags diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx index 112cb9fdd..877126726 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx @@ -251,7 +251,7 @@ void SimpleDatabase::ReturnSong(gcc_unused const LightSong *song) const noexcept { assert(song != nullptr); - assert(song == &light_song.Get() || song == prefixed_light_song); + assert(song == prefixed_light_song || song == &light_song.Get()); if (prefixed_light_song != nullptr) { delete prefixed_light_song;