summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-21 02:12:14 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-21 02:53:45 +0300
commitff10b54405fe8980a022e98cd79d912c1f0ac353 (patch)
tree679a8096d1e30858760196c2a2ef95ddd6bcd58c /src/gui/windows
parent6c01b391c288622d8e360d823c9c1e35a874fa58 (diff)
downloadplus-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.gz
plus-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.bz2
plus-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.xz
plus-ff10b54405fe8980a022e98cd79d912c1f0ac353.zip
Add missing checks.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/setupwindow.cpp3
-rw-r--r--src/gui/windows/shortcutwindow.cpp2
-rw-r--r--src/gui/windows/socialwindow.cpp6
-rw-r--r--src/gui/windows/textcommandeditor.cpp7
-rw-r--r--src/gui/windows/textdialog.cpp10
-rw-r--r--src/gui/windows/updaterwindow.cpp7
6 files changed, 27 insertions, 8 deletions
diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp
index 9deb27f65..29f9cf126 100644
--- a/src/gui/windows/setupwindow.cpp
+++ b/src/gui/windows/setupwindow.cpp
@@ -207,7 +207,8 @@ void SetupWindow::action(const ActionEvent &event)
void SetupWindow::setInGame(const bool inGame)
{
- mResetWindows->setEnabled(inGame);
+ if (mResetWindows)
+ mResetWindows->setEnabled(inGame);
}
void SetupWindow::externalUpdate()
diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp
index 774545cd6..ba3b97b46 100644
--- a/src/gui/windows/shortcutwindow.cpp
+++ b/src/gui/windows/shortcutwindow.cpp
@@ -167,7 +167,7 @@ void ShortcutWindow::addButton(const std::string &text,
void ShortcutWindow::addTab(const std::string &name,
ShortcutContainer *const content)
{
- if (!content)
+ if (!content || !mTabs)
return;
ScrollArea *const scroll = new ScrollArea(this, content, false);
scroll->setPosition(SCROLL_PADDING, SCROLL_PADDING);
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index fe8aaacbf..63a88c06f 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -352,6 +352,9 @@ void SocialWindow::action(const ActionEvent &event)
if (!serverFeatures->haveNativeGuilds())
return;
+ if (!mGuildCreateDialog)
+ return;
+
std::string name = mGuildCreateDialog->getText();
if (name.size() > 16)
@@ -374,6 +377,9 @@ void SocialWindow::action(const ActionEvent &event)
}
else if (eventId == "create party")
{
+ if (!mPartyCreateDialog)
+ return;
+
std::string name = mPartyCreateDialog->getText();
if (name.size() > 24)
diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp
index c2a5d66c9..5c59cd389 100644
--- a/src/gui/windows/textcommandeditor.cpp
+++ b/src/gui/windows/textcommandeditor.cpp
@@ -133,7 +133,8 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) :
mIconDropDown->setActionEventId("icon");
mIconDropDown->addActionListener(this);
- mIconDropDown->setSelectedString(mCommand->getIcon());
+ if (mCommand)
+ mIconDropDown->setSelectedString(mCommand->getIcon());
mSaveButton->adjustSize();
mCancelButton->adjustSize();
@@ -291,6 +292,8 @@ void TextCommandEditor::scheduleDelete()
void TextCommandEditor::save()
{
+ if (!mCommand)
+ return;
#ifdef TMWA_SUPPORT
if (mIsMagicCommand)
mCommand->setCommandType(TextCommandType::Magic);
@@ -318,6 +321,8 @@ void TextCommandEditor::save()
void TextCommandEditor::deleteCommand()
{
+ if (!mCommand)
+ return;
mCommand->setSymbol("");
mCommand->setCommand("");
mCommand->setComment("");
diff --git a/src/gui/windows/textdialog.cpp b/src/gui/windows/textdialog.cpp
index 442cd5c67..f72f60d4e 100644
--- a/src/gui/windows/textdialog.cpp
+++ b/src/gui/windows/textdialog.cpp
@@ -36,6 +36,11 @@
int TextDialog::instances = 0;
+namespace
+{
+ const std::string emptyStr;
+} // namespace
+
TextDialog::TextDialog(const std::string &restrict title,
const std::string &restrict msg,
Window *const parent,
@@ -110,15 +115,16 @@ const std::string &TextDialog::getText() const
{
if (mTextField)
return mTextField->getText();
- else
+ else if (mPasswordField)
return mPasswordField->getText();
+ return emptyStr;
}
void TextDialog::setText(const std::string &text)
{
if (mTextField)
mTextField->setText(text);
- else
+ else if (mPasswordField)
mPasswordField->setText(text);
}
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 242e32911..7d2e0c4f8 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -312,7 +312,8 @@ void UpdaterWindow::action(const ActionEvent &event)
// Skip the updating process
if (mDownloadStatus != UPDATE_COMPLETE)
{
- mDownload->cancel();
+ if (mDownload)
+ mDownload->cancel();
mDownloadStatus = UPDATE_ERROR;
}
}
@@ -846,8 +847,8 @@ void UpdaterWindow::logic()
mBrowserBox->addRow(_("##1 It is strongly recommended that"));
// TRANSLATORS: Begins "It is strongly recommended that".
mBrowserBox->addRow(_("##1 you try again later."));
-
- mBrowserBox->addRow(mDownload->getError());
+ if (mDownload)
+ mBrowserBox->addRow(mDownload->getError());
mScrollArea->setVerticalScrollAmount(
mScrollArea->getVerticalMaxScroll());
mDownloadStatus = UPDATE_COMPLETE;