if tag type for column is invalid, display empty column instead of crashing
This commit is contained in:
@@ -84,6 +84,7 @@ std::string Display::Columns()
|
|||||||
tag = "Comment";
|
tag = "Comment";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
tag.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (it->right_alignment)
|
if (it->right_alignment)
|
||||||
@@ -182,7 +183,7 @@ void Display::SongsInColumns(const MPD::Song &s, void *, Menu<MPD::Song> *menu)
|
|||||||
if (it->color != clDefault)
|
if (it->color != clDefault)
|
||||||
*menu << it->color;
|
*menu << it->color;
|
||||||
whline(menu->Raw(), 32, menu->GetWidth()-where);
|
whline(menu->Raw(), 32, menu->GetWidth()-where);
|
||||||
std::string tag = (s.*get)();
|
std::string tag = get ? (s.*get)() : "";
|
||||||
if (it->right_alignment)
|
if (it->right_alignment)
|
||||||
{
|
{
|
||||||
if (!tag.empty() || it->display_empty_tag)
|
if (!tag.empty() || it->display_empty_tag)
|
||||||
|
|||||||
@@ -919,9 +919,15 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
|||||||
Column col;
|
Column col;
|
||||||
col.color = IntoColor(GetLineValue(conf.song_list_columns_format, '[', ']', 1));
|
col.color = IntoColor(GetLineValue(conf.song_list_columns_format, '[', ']', 1));
|
||||||
std::string tag_type = GetLineValue(conf.song_list_columns_format, '{', '}', 1);
|
std::string tag_type = GetLineValue(conf.song_list_columns_format, '{', '}', 1);
|
||||||
col.type = tag_type.at(0);
|
if (tag_type.length() > 0) // at least tag type was specified
|
||||||
|
col.type = tag_type[0];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
col.type = 0;
|
||||||
|
col.display_empty_tag = 0;
|
||||||
|
}
|
||||||
col.fixed = *width.rbegin() == 'f';
|
col.fixed = *width.rbegin() == 'f';
|
||||||
for (std::string::const_iterator it = ++tag_type.begin(); it != tag_type.end(); ++it)
|
for (std::string::const_iterator it = tag_type.begin()+(tag_type.length() > 0); it != tag_type.end(); ++it)
|
||||||
{
|
{
|
||||||
switch (*it)
|
switch (*it)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user