From ff10b54405fe8980a022e98cd79d912c1f0ac353 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 21 Feb 2016 02:12:14 +0300 Subject: Add missing checks. --- src/gui/windows/textdialog.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/gui/windows/textdialog.cpp') 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); } -- cgit v1.2.3-70-g09d2