- uint64_t sample_limit;
- try {
- sample_limit = VariantBase::cast_dynamic<Variant<guint64>>(
- _device->config_get(ConfigKey::LIMIT_SAMPLES)).get();
- } catch (Error) {
- sample_limit = 0;
- }
+ const auto keys = device_->config_keys(
+ ConfigKey::DEVICE_OPTIONS);
+ const auto iter = keys.find(ConfigKey::LIMIT_SAMPLES);
+ const uint64_t sample_limit = (iter != keys.end() &&
+ (*iter).second.find(sigrok::GET) !=
+ (*iter).second.end()) ?
+ VariantBase::cast_dynamic<Variant<guint64>>(
+ device_->config_get(ConfigKey::LIMIT_SAMPLES)).get() : 0;