1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-29 19:28:47 -05:00

Fix crash if no device settings have been set up.

This commit is contained in:
Jon Beniston 2023-05-23 22:27:35 +01:00
parent 8260721f2d
commit 65013b47ff

View File

@ -811,28 +811,30 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name)
void SatelliteTrackerWorker::enableDoppler(SatWorkerState *satWorkerState) void SatelliteTrackerWorker::enableDoppler(SatWorkerState *satWorkerState)
{ {
QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *m_deviceSettingsList = m_settings.m_deviceSettings.value(satWorkerState->m_name); QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *m_deviceSettingsList = m_settings.m_deviceSettings.value(satWorkerState->m_name);
if (m_deviceSettingsList)
satWorkerState->m_doppler.clear();
bool requiresDoppler = false;
for (int i = 0; i < m_deviceSettingsList->size(); i++)
{ {
SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings = m_deviceSettingsList->at(i); satWorkerState->m_doppler.clear();
if (devSettings->m_doppler.size() > 0) bool requiresDoppler = false;
for (int i = 0; i < m_deviceSettingsList->size(); i++)
{ {
requiresDoppler = true; SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings = m_deviceSettingsList->at(i);
for (int j = 0; j < devSettings->m_doppler.size(); j++) { if (devSettings->m_doppler.size() > 0)
satWorkerState->m_doppler.append(0); {
requiresDoppler = true;
for (int j = 0; j < devSettings->m_doppler.size(); j++) {
satWorkerState->m_doppler.append(0);
}
} }
} }
} if (requiresDoppler)
if (requiresDoppler) {
{ qDebug() << "SatelliteTrackerWorker::applyDeviceAOSSettings: Enabling doppler for " << satWorkerState->m_name;
qDebug() << "SatelliteTrackerWorker::applyDeviceAOSSettings: Enabling doppler for " << satWorkerState->m_name; satWorkerState->m_dopplerTimer.setInterval(m_settings.m_dopplerPeriod * 1000);
satWorkerState->m_dopplerTimer.setInterval(m_settings.m_dopplerPeriod * 1000); satWorkerState->m_dopplerTimer.start();
satWorkerState->m_dopplerTimer.start(); connect(&satWorkerState->m_dopplerTimer, &QTimer::timeout, [this, satWorkerState]() {
connect(&satWorkerState->m_dopplerTimer, &QTimer::timeout, [this, satWorkerState]() { doppler(satWorkerState);
doppler(satWorkerState); });
}); }
} }
} }
@ -874,7 +876,7 @@ void SatelliteTrackerWorker::doppler(SatWorkerState *satWorkerState)
qDebug() << "SatelliteTrackerWorker::doppler " << satWorkerState->m_name; qDebug() << "SatelliteTrackerWorker::doppler " << satWorkerState->m_name;
QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *m_deviceSettingsList = m_settings.m_deviceSettings.value(satWorkerState->m_name); QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *m_deviceSettingsList = m_settings.m_deviceSettings.value(satWorkerState->m_name);
if (m_deviceSettingsList != nullptr) if (m_deviceSettingsList)
{ {
for (int i = 0; i < m_deviceSettingsList->size(); i++) for (int i = 0; i < m_deviceSettingsList->size(); i++)
{ {