Skip to content

Commit

Permalink
Test for empty key text first
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Dec 15, 2024
1 parent 84abe7a commit 5fe7daf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/library/dlgtrackinfomulti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,13 +807,13 @@ void DlgTrackInfoMulti::slotKeyTextChanged() {

QString newTextInput = txtKey->currentText().trimmed();
QString newKeyText;
mixxx::track::io::key::ChromaticKey newKey =
KeyUtils::guessKeyFromText(newTextInput);
if (newKey != mixxx::track::io::key::INVALID) {
newKeyText = KeyUtils::keyToString(newKey);
} else if (newTextInput.isEmpty()) {
// Empty text is not a valid key but indicates we want to clear the key.
newKeyText = QString();
// Empty text is not a valid key but indicates we want to clear the key.
if (!newTextInput.isEmpty()) {
mixxx::track::io::key::ChromaticKey newKey =
KeyUtils::guessKeyFromText(newTextInput);
if (newKey != mixxx::track::io::key::INVALID) {
newKeyText = KeyUtils::keyToString(newKey);
}
}

txtKey->blockSignals(true);
Expand Down

0 comments on commit 5fe7daf

Please sign in to comment.