Skip to content

Commit

Permalink
Correctly clamp frame numbers so that invalid frames are not possible
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 12, 2020
1 parent fb13b0f commit 6eaefb6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgstemporalnavigationobject.cpp
Expand Up @@ -81,7 +81,7 @@ void QgsTemporalNavigationObject::setCurrentFrameNumber( long long frameNumber )
{
if ( mCurrentFrameNumber != frameNumber )
{
mCurrentFrameNumber = frameNumber;
mCurrentFrameNumber = std::max( 0LL, std::min( frameNumber, totalFrameCount() - 1 ) );
QgsDateTimeRange range = dateTimeRangeForFrameNumber( mCurrentFrameNumber );
emit updateTemporalRange( range );
}
Expand Down Expand Up @@ -157,7 +157,7 @@ void QgsTemporalNavigationObject::rewindToStart()

void QgsTemporalNavigationObject::skipToEnd()
{
const long long frame = totalFrameCount();
const long long frame = totalFrameCount() - 1;
setCurrentFrameNumber( frame );
}

Expand Down

0 comments on commit 6eaefb6

Please sign in to comment.