diff options
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/killstats.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index c87fe3ebc..9a99937d5 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -148,8 +148,12 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mSortDropDown->setSelected(0); } - if (setupWindow && inventory->getType() != InventoryType::STORAGE) + if (setupWindow && + inventory && + inventory->getType() != InventoryType::STORAGE) + { setupWindow->registerWindowForReset(this); + } setResizable(true); setCloseButton(true); diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index efb0ea0df..919b11e9a 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -216,7 +216,8 @@ void KillStats::gainXp(int xp) if (!mKillCounter) mKillCounter = 1; - const float AvgExp = static_cast<float>(mExpCounter / mKillCounter); + const float AvgExp = static_cast<float>(mExpCounter) + / static_cast<float>(mKillCounter); int xpNextLevel(expNeed); if (mKillTimer == 0) @@ -348,7 +349,7 @@ void KillStats::update() mExpTime1Label->setCaption(strprintf(_(" Time for next level: %s"), toString(static_cast<float>((PlayerInfo::getAttribute( Attributes::EXP_NEEDED) - PlayerInfo::getAttribute( - Attributes::EXP)) / m1minSpeed)).c_str())); + Attributes::EXP)) / static_cast<float>(m1minSpeed))).c_str())); } else { diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 10a5f987b..20cafc2c6 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -661,6 +661,8 @@ void SkillDialog::playCastingDstEffect(const int id, Being *const being) const void SkillDialog::useSkill(const SkillInfo *const info) { + if (!info) + return; const SkillData *const data = info->data; if (data) { @@ -668,7 +670,7 @@ void SkillDialog::useSkill(const SkillInfo *const info) if (!cmd.empty()) SpellManager::invokeCommand(cmd, localPlayer->getTarget()); } - if (info && localPlayer) + if (localPlayer) { switch (info->type) { |