From 90c26f8c1b318c1f78ae17e96f285fb2cf9ad689 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 23 Mar 2023 22:36:44 +0100 Subject: [PATCH] Fix crash in LimeSDR start when the device is disconnected This fixes crash when a device which was enumerated on the application startup gets disconnected prior to the attempt to start the radio. The check is done after the existing work around for the LimeSuite bug. The idea is to give it the best possible chance for the radio to start. Possibly, the check needs needs to happen in the second LMS_Open() but ideally this needs to be verified against the original workaround scenario. --- source_modules/limesdr_source/src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source_modules/limesdr_source/src/main.cpp b/source_modules/limesdr_source/src/main.cpp index 5f7f4508..51eded74 100644 --- a/source_modules/limesdr_source/src/main.cpp +++ b/source_modules/limesdr_source/src/main.cpp @@ -330,7 +330,9 @@ private: if (err) { LMS_Close(_this->openDev); LMS_Open(&_this->openDev, _this->devList[_this->devId], NULL); - LMS_Init(_this->openDev); + if (LMS_Init(_this->openDev) != 0) { + return; + } } flog::warn("Channel count: {0}", LMS_GetNumChannels(_this->openDev, false));