Don't try to start an acquisition if the device is undefined.
void Session::start_capture(function<void (const QString)> error_handler)
{
void Session::start_capture(function<void (const QString)> error_handler)
{
+ if (!device_) {
+ error_handler(tr("No active device set, can't start acquisition."));
+ return;
+ }
+
stop_capture();
// Check that at least one channel is enabled
stop_capture();
// Check that at least one channel is enabled
const shared_ptr<sigrok::Device> sr_dev = device_->device();
if (sr_dev) {
const auto channels = sr_dev->channels();
const shared_ptr<sigrok::Device> sr_dev = device_->device();
if (sr_dev) {
const auto channels = sr_dev->channels();
assert(device);
assert(error_handler);
assert(device);
assert(error_handler);
+ if (!device_)
+ return;
cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);