diff --git a/mainwindow.cpp b/mainwindow.cpp index 4beabefe5..b8508b949 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3,7 +3,6 @@ #include "mainwindow.h" #include -#include #include #include @@ -953,8 +952,12 @@ void MainWindow::displayDialFrequency () bool valid {false}; for (int row = 0; row < frequencies->rowCount (); ++row) { + // we need to do specific checks for above and below here to + // ensure that we can use unsigned Radio::Frequency since we + // potentially use the full 64-bit unsigned range. auto working_frequency = frequencies->data (frequencies->index (row, 0)).value (); - if (std::llabs (working_frequency - m_dialFreq) < 10000) + auto offset = m_dialFreq > working_frequency ? m_dialFreq - working_frequency : working_frequency - m_dialFreq; + if (offset < 10000u) { valid = true; }