]> sigrok.org Git - pulseview.git/blobdiff - pv/data/logicsegment.cpp
LogicSegment: Limit end in get_subsampled_edges() if needed
[pulseview.git] / pv / data / logicsegment.cpp
index dff99c01742239665d7575029f34e7b2ab765918..62f188e383d4dff662874dce86d975f0ecbdf3a9 100644 (file)
@@ -314,7 +314,6 @@ void LogicSegment::get_subsampled_edges(
        bool last_sample;
        bool fast_forward;
 
-       assert(end <= get_sample_count());
        assert(start <= end);
        assert(min_length > 0);
        assert(sig_index >= 0);
@@ -322,6 +321,10 @@ void LogicSegment::get_subsampled_edges(
 
        lock_guard<recursive_mutex> lock(mutex_);
 
+       // Make sure we only process as many samples as we have
+       if (end > get_sample_count())
+               end = get_sample_count();
+
        const uint64_t block_length = (uint64_t)max(min_length, 1.0f);
        const unsigned int min_level = max((int)floorf(logf(min_length) /
                LogMipMapScaleFactor) - 1, 0);