mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-26 03:54:30 -04:00
Merge pull request #2812 from rgetz/rgetz-fix-2779
PlutoSDR: Guard against null buddy shared pointers | Fix #2779
This commit is contained in:
@@ -282,6 +282,11 @@ bool PlutoSDRInput::openDevice()
|
||||
|
||||
DeviceAPI *sinkBuddy = m_deviceAPI->getSinkBuddies()[0];
|
||||
DevicePlutoSDRShared* buddySharedPtr = (DevicePlutoSDRShared*) sinkBuddy->getBuddySharedPtr();
|
||||
if (!buddySharedPtr)
|
||||
{
|
||||
qCritical("PlutoSDRInput::openDevice: Tx buddy has no shared data");
|
||||
return false;
|
||||
}
|
||||
m_deviceShared.m_deviceParams = buddySharedPtr->m_deviceParams;
|
||||
|
||||
if (m_deviceShared.m_deviceParams == 0)
|
||||
@@ -379,7 +384,7 @@ void PlutoSDRInput::suspendBuddies()
|
||||
DeviceAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
||||
DevicePlutoSDRShared *buddyShared = (DevicePlutoSDRShared *) buddy->getBuddySharedPtr();
|
||||
|
||||
if (buddyShared->m_thread) {
|
||||
if (buddyShared && buddyShared->m_thread) {
|
||||
buddyShared->m_thread->stopWork();
|
||||
}
|
||||
}
|
||||
@@ -394,7 +399,7 @@ void PlutoSDRInput::resumeBuddies()
|
||||
DeviceAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
||||
DevicePlutoSDRShared *buddyShared = (DevicePlutoSDRShared *) buddy->getBuddySharedPtr();
|
||||
|
||||
if (buddyShared->m_thread) {
|
||||
if (buddyShared && buddyShared->m_thread) {
|
||||
buddyShared->m_thread->startWork();
|
||||
}
|
||||
}
|
||||
@@ -444,6 +449,12 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, const Q
|
||||
{
|
||||
DevicePlutoSDRShared *buddySharedPtr = (DevicePlutoSDRShared *) (*itSink)->getBuddySharedPtr();
|
||||
|
||||
if (!buddySharedPtr)
|
||||
{
|
||||
qWarning("PlutoSDRInput::applySettings: sink buddy has no shared data");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (buddySharedPtr->m_thread) {
|
||||
buddySharedPtr->m_thread->stopWork();
|
||||
buddySharedPtr->m_threadWasRunning = true;
|
||||
@@ -624,7 +635,7 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, const Q
|
||||
{
|
||||
DevicePlutoSDRShared *buddySharedPtr = (DevicePlutoSDRShared *) (*itSink)->getBuddySharedPtr();
|
||||
|
||||
if (buddySharedPtr->m_threadWasRunning) {
|
||||
if (buddySharedPtr && buddySharedPtr->m_threadWasRunning) {
|
||||
buddySharedPtr->m_thread->startWork();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user