DatabaseCommands: fix crash on "list base"
The string "base" is understood by locate_parse_type(), but not by listAllUniqueTags(). The special tag type LOCATE_TAG_BASE_TYPE causes a crash in PrintUniqueTag().
This commit is contained in:
parent
1d1f8be260
commit
c9aec3e866
|
@ -173,17 +173,12 @@ handle_list(Client &client, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
unsigned tagType = locate_parse_type(argv[1]);
|
unsigned tagType = locate_parse_type(argv[1]);
|
||||||
|
|
||||||
if (tagType == TAG_NUM_OF_ITEM_TYPES) {
|
if (tagType >= TAG_NUM_OF_ITEM_TYPES &&
|
||||||
|
tagType != LOCATE_TAG_FILE_TYPE) {
|
||||||
command_error(client, ACK_ERROR_ARG, "\"%s\" is not known", argv[1]);
|
command_error(client, ACK_ERROR_ARG, "\"%s\" is not known", argv[1]);
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagType == LOCATE_TAG_ANY_TYPE) {
|
|
||||||
command_error(client, ACK_ERROR_ARG,
|
|
||||||
"\"any\" is not a valid return tag type");
|
|
||||||
return CommandResult::ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
SongFilter *filter;
|
SongFilter *filter;
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
/* for compatibility with < 0.12.0 */
|
/* for compatibility with < 0.12.0 */
|
||||||
|
|
|
@ -261,6 +261,8 @@ listAllUniqueTags(Client &client, unsigned type,
|
||||||
std::ref(client), _1);
|
std::ref(client), _1);
|
||||||
return db->Visit(selection, f, error);
|
return db->Visit(selection, f, error);
|
||||||
} else {
|
} else {
|
||||||
|
assert(type < TAG_NUM_OF_ITEM_TYPES);
|
||||||
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
const auto f = std::bind(PrintUniqueTag, std::ref(client),
|
const auto f = std::bind(PrintUniqueTag, std::ref(client),
|
||||||
(TagType)type, _1);
|
(TagType)type, _1);
|
||||||
|
|
Loading…
Reference in New Issue