Skip to content

Commit 7d48a7b

Browse files
committed
Fix bug where pressing home on empty tag field crashes the program.
1 parent 740994e commit 7d48a7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/gui/tag/TagsEdit.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ struct TagsEdit::Impl
337337
assert(i < tags.size());
338338
auto occurrencesOfCurrentText =
339339
std::count_if(tags.cbegin(), tags.cend(), [this](const auto& tag) { return tag.text == currentText(); });
340-
if (currentText().isEmpty() || occurrencesOfCurrentText > 1) {
340+
if ((currentText().isEmpty() && tags.size() > 1) || occurrencesOfCurrentText > 1) {
341341
tags.erase(std::next(tags.begin(), std::ptrdiff_t(editing_index)));
342342
if (editing_index <= i) { // Do we shift positions after `i`?
343343
--i;

0 commit comments

Comments
 (0)