projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Session: Made update_signals handle having a missing device gracefully
[pulseview.git]
/
pv
/
session.cpp
diff --git
a/pv/session.cpp
b/pv/session.cpp
index 2cdc25f83ed0ee3c718896da9d8df98d13f34876..542b88b798188696eabc216947065bf5f43c06ce 100644
(file)
--- a/
pv/session.cpp
+++ b/
pv/session.cpp
@@
-306,8
+306,15
@@
void Session::update_signals(shared_ptr<devices::Device> device)
assert(device);
assert(capture_state_ == Stopped);
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
// 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) {
unsigned int logic_channel_count = std::count_if(
channels.begin(), channels.end(),
[] (shared_ptr<Channel> channel) {
@@
-334,7
+341,7
@@
void Session::update_signals(shared_ptr<devices::Device> device)
unordered_set< shared_ptr<view::Signal> > prev_sigs(signals_);
signals_.clear();
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
shared_ptr<view::Signal> signal;
// Find the channel in the old signals