mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -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;
|
bool found = false;
|
||||||
|
|
||||||
const int *attenuations = SDRPlayV3LNA::getAttenuations(m_sdrPlayV3Input->getDeviceId(), m_settings.m_centerFrequency);
|
const int *attenuations = SDRPlayV3LNA::getAttenuations(m_sdrPlayV3Input->getDeviceId(), m_settings.m_centerFrequency);
|
||||||
int len = attenuations[0];
|
|
||||||
ui->gainLNA->blockSignals(true);
|
ui->gainLNA->blockSignals(true);
|
||||||
ui->gainLNA->clear();
|
ui->gainLNA->clear();
|
||||||
for (int i = 1; i <= len; i++)
|
if (attenuations)
|
||||||
{
|
{
|
||||||
if (attenuations[i] == 0)
|
int len = attenuations[0];
|
||||||
ui->gainLNA->addItem("0");
|
for (int i = 1; i <= len; i++)
|
||||||
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);
|
if (attenuations[i] == 0)
|
||||||
found = true;
|
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);
|
ui->gainLNA->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user