X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=pv%2Fdata%2Fdecodesignal.cpp;h=00812917013ae361f739ea649dbf9611792bef0e;hb=fae7037ab7ba0422c9f6d8a0523fd53a1b9cedfe;hp=ad5a27a9f254f6c041dcd2d75e8eda252382dbf3;hpb=ac9494eff3ebc74ae7a87746a4d8668c68f32b52;p=pulseview.git diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index ad5a27a9..00812917 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -442,15 +442,13 @@ int64_t DecodeSignal::get_decoded_sample_count(uint32_t segment_id, int64_t result = 0; - try { - const DecodeSegment *segment = &(segments_.at(segment_id)); - if (include_processing) - result = segment->samples_decoded_incl; - else - result = segment->samples_decoded_excl; - } catch (out_of_range&) { - // Do nothing - } + if (segment_id >= segments_.size()) + return result; + + if (include_processing) + result = segments_[segment_id].samples_decoded_incl; + else + result = segments_[segment_id].samples_decoded_excl; return result; } @@ -493,18 +491,16 @@ void DecodeSignal::get_annotation_subset( { lock_guard lock(output_mutex_); - try { - const DecodeSegment *segment = &(segments_.at(segment_id)); - const map *rows = - &(segment->annotation_rows); + if (segment_id >= segments_.size()) + return; - const auto iter = rows->find(row); - if (iter != rows->end()) - (*iter).second.get_annotation_subset(dest, - start_sample, end_sample); - } catch (out_of_range&) { - // Do nothing - } + const DecodeSegment *segment = &(segments_.at(segment_id)); + const map *rows = + &(segment->annotation_rows); + + const auto iter = rows->find(row); + if (iter != rows->end()) + (*iter).second.get_annotation_subset(dest, start_sample, end_sample); } void DecodeSignal::get_annotation_subset( @@ -537,6 +533,9 @@ void DecodeSignal::get_annotation_subset( uint32_t DecodeSignal::get_binary_data_chunk_count(uint32_t segment_id, const Decoder* dec, uint32_t bin_class_id) const { + if (segments_.size() == 0) + return 0; + try { const DecodeSegment *segment = &(segments_.at(segment_id)); @@ -1351,7 +1350,7 @@ void DecodeSignal::create_decode_segment() for (uint32_t i = 0; i < n; i++) segments_.back().binary_classes.push_back( - {dec.get(), dec->get_binary_class(i), vector()}); + {dec.get(), dec->get_binary_class(i), deque()}); } } @@ -1426,7 +1425,7 @@ void DecodeSignal::binary_callback(srd_proto_data *pdata, void *decode_signal) DecodeBinaryClass* bin_class = nullptr; for (DecodeBinaryClass& bc : segment->binary_classes) - if ((bc.decoder->decoder() == decc) && (bc.info->bin_class_id == pdb->bin_class)) + if ((bc.decoder->decoder() == decc) && (bc.info->bin_class_id == (uint32_t)pdb->bin_class)) bin_class = &bc; if (!bin_class) {