From: Joel Holdsworth Date: Fri, 17 Jan 2014 18:41:31 +0000 (+0000) Subject: pv::view::View::get_time_extents: Assume samplerate is 1 if given an invalid value X-Git-Tag: pulseview-0.2.0~144 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a472a884a9d2d17eb31a8a02322608fe7d71e8a3;p=pulseview.git pv::view::View::get_time_extents: Assume samplerate is 1 if given an invalid value Fixes #278 --- diff --git a/pv/view/view.cpp b/pv/view/view.cpp index a437918d..35195b58 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -286,9 +286,12 @@ pair View::get_time_extents() const BOOST_FOREACH(const shared_ptr 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);