diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-21 02:12:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-21 02:53:45 +0300 |
commit | ff10b54405fe8980a022e98cd79d912c1f0ac353 (patch) | |
tree | 679a8096d1e30858760196c2a2ef95ddd6bcd58c /src/gui/widgets | |
parent | 6c01b391c288622d8e360d823c9c1e35a874fa58 (diff) | |
download | manaverse-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.gz manaverse-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.bz2 manaverse-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.xz manaverse-ff10b54405fe8980a022e98cd79d912c1f0ac353.zip |
Add missing checks.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/characterdisplay.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/layoutcell.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/selldialog.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/setupitem.cpp | 9 |
4 files changed, 17 insertions, 8 deletions
diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index 7aed3469c..560e1cb54 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -121,7 +121,7 @@ void CharacterDisplay::mouseExited(MouseEvent &event A_UNUSED) void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED) { - if (!gui || !textPopup) + if (!gui || !textPopup || !mCharacter) return; int mouseX = 0; diff --git a/src/gui/widgets/layoutcell.cpp b/src/gui/widgets/layoutcell.cpp index 2ab016ca4..1e46c1ca7 100644 --- a/src/gui/widgets/layoutcell.cpp +++ b/src/gui/widgets/layoutcell.cpp @@ -43,7 +43,11 @@ LayoutArray &LayoutCell::getArray() if (mType == WIDGET) return tempArray; if (mType == ARRAY) + { + if (!mArray) + return tempArray; return *mArray; + } mArray = new LayoutArray; mType = ARRAY; diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp index 189babc89..17664ed78 100644 --- a/src/gui/widgets/selldialog.cpp +++ b/src/gui/widgets/selldialog.cpp @@ -199,7 +199,8 @@ SellDialog::~SellDialog() void SellDialog::reset() { mShopItems->clear(); - mSlider->setValue(0); + if (mSlider) + mSlider->setValue(0); mShopItemList->setSelected(-1); updateButtonsAndLabels(); } @@ -256,8 +257,11 @@ void SellDialog::action(const ActionEvent &event) if (eventId == "slider") { - mAmountItems = CAST_S32(mSlider->getValue()); - updateButtonsAndLabels(); + if (mSlider) + { + mAmountItems = CAST_S32(mSlider->getValue()); + updateButtonsAndLabels(); + } } else if (eventId == "inc" && mSlider && mAmountItems < mMaxItems) { diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index be9f2000f..511ab90ab 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -406,7 +406,7 @@ void SetupItemTextField::action(const ActionEvent &event) return; const std::string &eventId = event.getId(); - if (eventId == mWidget->getActionEventId()) + if (mWidget && eventId == mWidget->getActionEventId()) { fromWidget(); } @@ -544,7 +544,7 @@ void SetupItemIntTextField::action(const ActionEvent &event) return; const std::string &eventId = event.getId(); - if (eventId == mWidget->getActionEventId()) + if (mWidget && eventId == mWidget->getActionEventId()) { fromWidget(); } @@ -1153,14 +1153,15 @@ void SetupItemSound::addMoreControls() { mButton = new Button(this, BUTTON_PLAY, 16, 16, mEventName + "_PLAY", this); - mHorizont->add(mButton); + if (mHorizont) + mHorizont->add(mButton); } void SetupItemSound::action(const ActionEvent &event) { if (event.getId() == mEventName + "_PLAY") { - if (mSlider->getSelected()) + if (mSlider && mSlider->getSelected()) { soundManager.playGuiSfx(branding.getStringValue("systemsounds") .append(mSlider->getSelectedString()).append(".ogg")); |