1
0
Fork 0

Launcher: fix location not saving

When the history was empty, the ‘don’t re-insert’ logic was breaking,
because the beginning and end of the vector range were equivalent.
This commit is contained in:
James Turner 2018-05-31 21:25:13 +02:00
parent dcec806337
commit 3da6d42945

View file

@ -71,7 +71,7 @@ void RecentLocationsModel::insert(QVariant location)
QVariant locDesc = location.toMap().value("text");
auto it = std::find_if(m_data.begin(), m_data.end(),
[locDesc](QVariant v) { return v.toMap().value("text") == locDesc; });
if (it == m_data.begin()) {
if (!m_data.empty() && (it == m_data.begin())) {
// special, common case - nothing to do
return;
}