From 397155983d36ff92cec1f09e8b41456009a97b7a Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Mon, 6 Dec 2021 15:50:03 +0100 Subject: [PATCH] improve handling of failed devices --- owrx/fft.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/owrx/fft.py b/owrx/fft.py index 473ab7d..dd1f10d 100644 --- a/owrx/fft.py +++ b/owrx/fft.py @@ -77,8 +77,9 @@ class SpectrumThread(SdrSourceEventClient): return self.dsp.stop() self.dsp = None - self.reader.stop() - self.reader = None + if self.reader: + self.reader.stop() + self.reader = None self.sdrSource.removeClient(self) while self.subscriptions: self.subscriptions.pop().cancel() @@ -92,7 +93,8 @@ class SpectrumThread(SdrSourceEventClient): def onStateChange(self, state: SdrSourceState): if state is SdrSourceState.STOPPING: - self.dsp.stop() + if self.dsp: + self.dsp.stop() elif state == SdrSourceState.RUNNING: if self.dsp is None: self.start()