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/windows/textdialog.cpp | |
parent | 6c01b391c288622d8e360d823c9c1e35a874fa58 (diff) | |
download | manaplus-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.gz manaplus-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.bz2 manaplus-ff10b54405fe8980a022e98cd79d912c1f0ac353.tar.xz manaplus-ff10b54405fe8980a022e98cd79d912c1f0ac353.zip |
Add missing checks.
Diffstat (limited to 'src/gui/windows/textdialog.cpp')
-rw-r--r-- | src/gui/windows/textdialog.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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); } |