From e0d14cf8d3c809a0a5291823d3a962a4835a8f6e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 9 Aug 2015 00:25:50 +0300 Subject: Add some missing checks to gui found by paranucker. --- src/gui/windows/confirmdialog.h | 2 +- src/gui/windows/editdialog.h | 2 +- src/gui/windows/inventorywindow.h | 4 ++-- src/gui/windows/skilldialog.cpp | 2 ++ src/gui/windows/skilldialog.h | 8 ++++---- 5 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/gui/windows') diff --git a/src/gui/windows/confirmdialog.h b/src/gui/windows/confirmdialog.h index 2b3951dad..91132b641 100644 --- a/src/gui/windows/confirmdialog.h +++ b/src/gui/windows/confirmdialog.h @@ -64,7 +64,7 @@ class ConfirmDialog notfinal : public Window, void postInit() override final; private: - TextBox *mTextBox; + TextBox *mTextBox A_NONNULLPOINTER; bool mIgnore; }; diff --git a/src/gui/windows/editdialog.h b/src/gui/windows/editdialog.h index ef77fcdcd..f76b163b7 100644 --- a/src/gui/windows/editdialog.h +++ b/src/gui/windows/editdialog.h @@ -66,7 +66,7 @@ class EditDialog final : public Window, private: std::string mEventOk; - TextField *mTextField; + TextField *mTextField A_NONNULLPOINTER; }; #endif // GUI_WINDOWS_EDITDIALOG_H diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index 062ac6bce..eca01ab05 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -128,7 +128,7 @@ class InventoryWindow final : public Window, void slotsChanged(Inventory *const inventory) override final; bool isMainInventory() const A_WARN_UNUSED - { return mInventory->isMainInventory(); } + { return mInventory ? mInventory->isMainInventory() : false; } /** * Returns true if any instances exist. @@ -174,7 +174,7 @@ class InventoryWindow final : public Window, static WindowList invInstances; Inventory *mInventory; - ItemContainer *mItems; + ItemContainer *mItems A_NONNULLPOINTER; Button *mUseButton; Button *mDropButton; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 89b614e8d..9c1cbc618 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -115,6 +115,8 @@ void SkillDialog::action(const ActionEvent &event) const std::string &eventId = event.getId(); if (eventId == "inc") { + if (!playerHandler) + return; const SkillTab *const tab = static_cast( mTabs->getSelectedTab()); if (tab) diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 7c8329ce9..29cc69165 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -145,11 +145,11 @@ class SkillDialog final : public Window, typedef std::map SkillMap; SkillMap mSkills; std::vector mDurations; - TabbedArea *mTabs; + TabbedArea *mTabs A_NONNULLPOINTER; std::list mDeleteTabs; - Label *mPointsLabel; - Button *mUseButton; - Button *mIncreaseButton; + Label *mPointsLabel A_NONNULLPOINTER; + Button *mUseButton A_NONNULLPOINTER; + Button *mIncreaseButton A_NONNULLPOINTER; SkillModel *mDefaultModel; }; -- cgit v1.2.3-70-g09d2