Various minor whitespace and consistency fixes.
[pulseview.git] / pv / binding / device.cpp
index 32edea164144786d0ef9ad8aeab525dc99363eb8..77c772c088b07dabcbba1ed782339560527dae09 100644 (file)
@@ -56,9 +56,15 @@ namespace binding {
 Device::Device(shared_ptr<sigrok::Configurable> configurable) :
        configurable_(configurable)
 {
-       assert(configurable);
+       std::map< const ConfigKey*, std::set<Capability> > keys;
 
-       for (auto entry : configurable->config_keys(ConfigKey::DEVICE_OPTIONS)) {
+       try {
+               keys = configurable->config_keys(ConfigKey::DEVICE_OPTIONS);
+       } catch (const Error) {
+               return;
+       }
+
+       for (auto entry : keys) {
                auto key = entry.first;
                auto capabilities = entry.second;
 
@@ -82,8 +88,7 @@ Device::Device(shared_ptr<sigrok::Configurable> configurable) :
                        config_changed();
                };
 
-               switch (key->id())
-               {
+               switch (key->id()) {
                case SR_CONF_SAMPLERATE:
                        // Sample rate values are not bound because they are shown
                        // in the MainBar