From fb09bd6c12e684d0c979ec07d12930071856bcc6 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 26 Jun 2014 10:24:39 +0000 Subject: [PATCH] From Laurens Voerman, "while debugging ImageSequence I had a crash, due to the very large frametimes caused by halting the program. The problem is that when the frame time exceeds the length of the entire image sequence, a looping sequence will try to read it's _imageDataList beyond its size. fix attached for src/osg/ImageSequence.cpp" git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14292 16af8721-9629-0410-8352-f15c8da7e697 --- src/osg/ImageSequence.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/osg/ImageSequence.cpp b/src/osg/ImageSequence.cpp index c83c08b63..a4540b7b7 100644 --- a/src/osg/ImageSequence.cpp +++ b/src/osg/ImageSequence.cpp @@ -396,17 +396,8 @@ void ImageSequence::update(osg::NodeVisitor* nv) if (startLoadIndex<0) startLoadIndex = 0; int endLoadIndex = int(preLoadTime/_timePerImage); - if (endLoadIndex>=int(_imageDataList.size())) - { - if (looping) - { - endLoadIndex -= int(_imageDataList.size()); - } - else - { - endLoadIndex = int(_imageDataList.size())-1; - } - } + if (looping && (endLoadIndex>=int(_imageDataList.size()))) endLoadIndex -= int(_imageDataList.size()); + if (endLoadIndex>=int(_imageDataList.size())) endLoadIndex = int(_imageDataList.size())-1; if (endLoadIndex<0) endLoadIndex = 0; double requestTime = time;