From 5fe7dafbaf162721d417472d352a2c4038247b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Fri, 13 Dec 2024 21:27:36 +0100 Subject: [PATCH] Test for empty key text first --- src/library/dlgtrackinfomulti.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/library/dlgtrackinfomulti.cpp b/src/library/dlgtrackinfomulti.cpp index 8f352d17d41..76dd8c95adb 100644 --- a/src/library/dlgtrackinfomulti.cpp +++ b/src/library/dlgtrackinfomulti.cpp @@ -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);