]> sigrok.org Git - pulseview.git/commitdiff
Session: Handle failing sigrok::Device::read_config() calls
authorSoeren Apel <redacted>
Mon, 4 Jun 2018 16:33:43 +0000 (18:33 +0200)
committerUwe Hermann <redacted>
Tue, 5 Jun 2018 23:10:32 +0000 (01:10 +0200)
pv/session.cpp

index fba49be8900139f5405b7e4f6d461d235004aa8f..797a461bf2d6ffbec1cb3deab085df21abfdb283 100644 (file)
@@ -950,7 +950,11 @@ void Session::sample_thread_proc(function<void (const QString)> error_handler)
        if (!device_)
                return;
 
-       cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
+       try {
+               cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
+       } catch (Error& e) {
+               cur_samplerate_ = 0;
+       }
 
        out_of_memory_ = false;
 
@@ -1161,7 +1165,11 @@ void Session::feed_in_logic(shared_ptr<Logic> logic)
        }
 
        if (!cur_samplerate_)
-               cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
+               try {
+                       cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
+               } catch (Error& e) {
+                       // Do nothing
+               }
 
        lock_guard<recursive_mutex> lock(data_mutex_);
 
@@ -1198,7 +1206,11 @@ void Session::feed_in_analog(shared_ptr<Analog> analog)
        }
 
        if (!cur_samplerate_)
-               cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
+               try {
+                       cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
+               } catch (Error& e) {
+                       // Do nothing
+               }
 
        lock_guard<recursive_mutex> lock(data_mutex_);