code hardening, should help on bug #385

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16981 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-04-03 11:57:49 +00:00
parent c0a7267732
commit 224a6b047f

View File

@ -876,9 +876,11 @@ BSlider::DrawHashMarks()
} }
float pos = _MinPosition(); float pos = _MinPosition();
float factor = (_MaxPosition() - pos) / (fHashMarkCount - 1); float factor = 0.0f;
if (fHashMarkCount > 1)
factor = (_MaxPosition() - pos) / (fHashMarkCount - 1);
if (fHashMarks & B_HASH_MARKS_TOP) { if (fHashMarks & B_HASH_MARKS_TOP && fHashMarkCount > 0) {
view->BeginLineArray(fHashMarkCount * 2); view->BeginLineArray(fHashMarkCount * 2);
@ -907,7 +909,7 @@ BSlider::DrawHashMarks()
pos = _MinPosition(); pos = _MinPosition();
if (fHashMarks & B_HASH_MARKS_BOTTOM) { if (fHashMarks & B_HASH_MARKS_BOTTOM && fHashMarkCount > 0) {
view->BeginLineArray(fHashMarkCount * 2); view->BeginLineArray(fHashMarkCount * 2);
if (fOrientation == B_HORIZONTAL) { if (fOrientation == B_HORIZONTAL) {