projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
30d6f09
)
Session: Made update_signals handle having a missing device gracefully
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Mon, 6 Apr 2015 09:14:30 +0000
(10:14 +0100)
committer
Uwe Hermann
<uwe@hermann-uwe.de>
Thu, 11 Jun 2015 18:38:47 +0000
(20:38 +0200)
pv/session.cpp
patch
|
blob
|
history
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