From: Soeren Apel Date: Mon, 4 Jun 2018 16:33:43 +0000 (+0200) Subject: Session: Handle failing sigrok::Device::read_config() calls X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e170ab6531b39e51dce725f000fddd57b88d8561;p=pulseview.git Session: Handle failing sigrok::Device::read_config() calls --- diff --git a/pv/session.cpp b/pv/session.cpp index fba49be8..797a461b 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -950,7 +950,11 @@ void Session::sample_thread_proc(function error_handler) if (!device_) return; - cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); + try { + cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); + } catch (Error& e) { + cur_samplerate_ = 0; + } out_of_memory_ = false; @@ -1161,7 +1165,11 @@ void Session::feed_in_logic(shared_ptr logic) } if (!cur_samplerate_) - cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); + try { + cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); + } catch (Error& e) { + // Do nothing + } lock_guard lock(data_mutex_); @@ -1198,7 +1206,11 @@ void Session::feed_in_analog(shared_ptr analog) } if (!cur_samplerate_) - cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); + try { + cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); + } catch (Error& e) { + // Do nothing + } lock_guard lock(data_mutex_);