mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
SDRplay: Prevent nullpointer dereference for #1825
This commit is contained in:
parent
480241fa8e
commit
9098f26679
@ -320,23 +320,30 @@ void SDRPlayV3Gui::updateLNAValues()
|
||||
bool found = false;
|
||||
|
||||
const int *attenuations = SDRPlayV3LNA::getAttenuations(m_sdrPlayV3Input->getDeviceId(), m_settings.m_centerFrequency);
|
||||
int len = attenuations[0];
|
||||
ui->gainLNA->blockSignals(true);
|
||||
ui->gainLNA->clear();
|
||||
for (int i = 1; i <= len; i++)
|
||||
if (attenuations)
|
||||
{
|
||||
if (attenuations[i] == 0)
|
||||
ui->gainLNA->addItem("0");
|
||||
else
|
||||
ui->gainLNA->addItem(QString("-%1").arg(attenuations[i]));
|
||||
|
||||
// Find closest match
|
||||
if ((attenuations[i] == -currentValue) || (!found && (attenuations[i] > -currentValue)))
|
||||
int len = attenuations[0];
|
||||
for (int i = 1; i <= len; i++)
|
||||
{
|
||||
ui->gainLNA->setCurrentIndex(i - 1);
|
||||
found = true;
|
||||
if (attenuations[i] == 0)
|
||||
ui->gainLNA->addItem("0");
|
||||
else
|
||||
ui->gainLNA->addItem(QString("-%1").arg(attenuations[i]));
|
||||
|
||||
// Find closest match
|
||||
if ((attenuations[i] == -currentValue) || (!found && (attenuations[i] > -currentValue)))
|
||||
{
|
||||
ui->gainLNA->setCurrentIndex(i - 1);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "SDRPlayV3Gui::updateLNAValues: No attenuations for deviceID: " << m_sdrPlayV3Input->getDeviceId();
|
||||
}
|
||||
ui->gainLNA->blockSignals(false);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user