X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fsession.cpp;h=542b88b798188696eabc216947065bf5f43c06ce;hb=c6412b47eb1f5529fd76247caa7de09b6c9693d5;hp=d5126660f56b140d2337d64b1df625a4ea44b148;hpb=3084ed4b15663dd717ff656745db305f377ab215;p=pulseview.git diff --git a/pv/session.cpp b/pv/session.cpp index d512666..542b88b 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -306,8 +306,15 @@ void Session::update_signals(shared_ptr device) assert(device); assert(capture_state_ == Stopped); + const shared_ptr sr_dev = device->device(); + if (!sr_dev) { + signals_.clear(); + logic_data_.reset(); + return; + } + // Detect what data types we will receive - auto channels = device->device()->channels(); + auto channels = sr_dev->channels(); unsigned int logic_channel_count = std::count_if( channels.begin(), channels.end(), [] (shared_ptr channel) { @@ -334,7 +341,7 @@ void Session::update_signals(shared_ptr device) unordered_set< shared_ptr > prev_sigs(signals_); signals_.clear(); - for (auto channel : device->device()->channels()) { + for (auto channel : sr_dev->channels()) { shared_ptr signal; // Find the channel in the old signals @@ -400,7 +407,12 @@ shared_ptr Session::signal_from_channel( void Session::read_sample_rate(shared_ptr device) { assert(device); - const auto keys = device->config_keys(ConfigKey::DEVICE_OPTIONS); + map< const ConfigKey*, set > keys; + + try { + keys = device->config_keys(ConfigKey::DEVICE_OPTIONS); + } catch (const Error) {} + const auto iter = keys.find(ConfigKey::SAMPLERATE); cur_samplerate_ = (iter != keys.end() && (*iter).second.find(sigrok::GET) != (*iter).second.end()) ?