diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp index bc4e66640af..b1d6e75e748 100644 --- a/src/preferences/dialog/dlgprefsound.cpp +++ b/src/preferences/dialog/dlgprefsound.cpp @@ -68,7 +68,8 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, &DlgPrefSound::apiChanged); sampleRateComboBox->clear(); - for (const auto& sampleRate : m_pSoundManager->getSampleRates()) { + const auto sampleRates = m_pSoundManager->getSampleRates(); + for (const auto& sampleRate : sampleRates) { if (sampleRate.isValid()) { // no ridiculous sample rate values. prohibiting zero means // avoiding a potential div-by-0 error in ::updateLatencies