assert(device);
assert(capture_state_ == Stopped);
+ const shared_ptr<sigrok::Device> 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> channel) {
unordered_set< shared_ptr<view::Signal> > prev_sigs(signals_);
signals_.clear();
- for (auto channel : device->device()->channels()) {
+ for (auto channel : sr_dev->channels()) {
shared_ptr<view::Signal> signal;
// Find the channel in the old signals
void Session::read_sample_rate(shared_ptr<sigrok::Device> device)
{
assert(device);
- const auto keys = device->config_keys(ConfigKey::DEVICE_OPTIONS);
+ map< const ConfigKey*, set<sigrok::Capability> > 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()) ?