]> sigrok.org Git - pulseview.git/commitdiff
pv::view::View::get_time_extents: Assume samplerate is 1 if given an invalid value
authorJoel Holdsworth <redacted>
Fri, 17 Jan 2014 18:41:31 +0000 (18:41 +0000)
committerJoel Holdsworth <redacted>
Fri, 17 Jan 2014 18:50:52 +0000 (18:50 +0000)
Fixes #278

pv/view/view.cpp

index a437918d9f2a88f3001f35ae9eb33b854530924c..35195b58dc150c8743f5d623e7495ccb1ecd5412 100644 (file)
@@ -286,9 +286,12 @@ pair<double, double> View::get_time_extents() const
        BOOST_FOREACH(const shared_ptr<SignalData> d, visible_data)
        {
                const double start_time = d->get_start_time();
+               double samplerate = d->samplerate();
+               samplerate = (samplerate <= 0.0) ? 1.0 : samplerate;
+
                left_time = min(left_time, start_time);
                right_time = max(right_time, start_time +
-                       d->get_max_sample_count() / d->samplerate());
+                       d->get_max_sample_count() / samplerate);
        }
 
        assert(left_time < right_time);