Commit f6623a32 authored by cutealien's avatar cutealien

Fix: Prevent division by 0 in CGUIScrollBar::setPos


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5209 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 0e48c939
-------------------------- --------------------------
Changes in 1.9 (not yet released) Changes in 1.9 (not yet released)
- Fix: Prevent division by 0 in CGUIScrollBar::setPos
- Fix: Add missing serialization to CSceneNodeAnimatorCameraFPS and CSceneNodeAnimatorCameraMaya - Fix: Add missing serialization to CSceneNodeAnimatorCameraFPS and CSceneNodeAnimatorCameraMaya
- Fix: File-open dialog now restores the original locale after modifying it internally - Fix: File-open dialog now restores the original locale after modifying it internally
- Fix first calculation of the camerascenenode boundingsphere. - Fix first calculation of the camerascenenode boundingsphere.
......
...@@ -348,6 +348,8 @@ void CGUIScrollBar::setPos(s32 pos) ...@@ -348,6 +348,8 @@ void CGUIScrollBar::setPos(s32 pos)
{ {
Pos = core::s32_clamp ( pos, Min, Max ); Pos = core::s32_clamp ( pos, Min, Max );
if ( core::isnotzero ( range() ) )
{
if (Horizontal) if (Horizontal)
{ {
f32 f = (RelativeRect.getWidth() - ((f32)RelativeRect.getHeight()*3.0f)) / range(); f32 f = (RelativeRect.getWidth() - ((f32)RelativeRect.getHeight()*3.0f)) / range();
...@@ -361,7 +363,7 @@ void CGUIScrollBar::setPos(s32 pos) ...@@ -361,7 +363,7 @@ void CGUIScrollBar::setPos(s32 pos)
DrawPos = (s32)( ( ( Pos - Min ) * f) + ((f32)RelativeRect.getWidth() * 0.5f)); DrawPos = (s32)( ( ( Pos - Min ) * f) + ((f32)RelativeRect.getWidth() * 0.5f));
DrawHeight = RelativeRect.getWidth(); DrawHeight = RelativeRect.getWidth();
} }
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment