]> sigrok.org Git - pulseview.git/commitdiff
Fix #829 by not throwing when device can't be used
authorSoeren Apel <redacted>
Thu, 2 Mar 2017 22:07:53 +0000 (23:07 +0100)
committerUwe Hermann <redacted>
Tue, 7 Mar 2017 21:59:23 +0000 (22:59 +0100)
pv/session.cpp

index c9a569f7f9e9d67fb3288b16a724accf8e761428..31cbb73c19e1fb37fde8955dff2de9e35062f683 100644 (file)
@@ -415,16 +415,17 @@ void Session::set_device(shared_ptr<devices::Device> device)
                device_->open();
        } catch (const QString &e) {
                device_.reset();
-               device_changed();
-               throw;
        }
 
-       device_->session()->add_datafeed_callback([=]
-               (shared_ptr<sigrok::Device> device, shared_ptr<Packet> packet) {
-                       data_feed_in(device, packet);
-               });
+       if (device_) {
+               device_->session()->add_datafeed_callback([=]
+                       (shared_ptr<sigrok::Device> device, shared_ptr<Packet> packet) {
+                               data_feed_in(device, packet);
+                       });
+
+               update_signals();
+       }
 
-       update_signals();
        device_changed();
 }