From f1b82c1b06604c2c1eed750a6c980aa0b5355560 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 11 Oct 2013 14:48:19 +0300 Subject: First part of checks from Parasoft C++ Test. --- src/gui/windows/statuswindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gui/windows/statuswindow.cpp') diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index bbc4558b0..87dc94e8e 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -598,8 +598,12 @@ void StatusWindow::updateWeightBar(ProgressBar *const bar) const int totalWeight = PlayerInfo::getAttribute( PlayerInfo::TOTAL_WEIGHT); const int maxWeight = PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT); - const float progress = static_cast(totalWeight) - / static_cast(maxWeight); + float progress = 1.0F; + if (maxWeight) + { + progress = static_cast(totalWeight) + / static_cast(maxWeight); + } bar->setText(strprintf("%s/%s", Units::formatWeight( totalWeight).c_str(), Units::formatWeight(maxWeight).c_str())); bar->setProgress(progress); -- cgit v1.2.3-60-g2f50