diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-10-20 11:42:14 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-10-20 11:42:14 +0100 |
| commit | 00b60f52add041a36fa62118baf4b5ac78993980 (patch) | |
| tree | a1427c61dc4ed0a17bb9f120985481f1772b9d50 /src/wx/email_dialog.cc | |
| parent | bd3be0efd59054666fd04d69715275f257994f5e (diff) | |
Give a better error if the user tries to load a non-KDM as a DKDM into the KDM creator.
Diffstat (limited to 'src/wx/email_dialog.cc')
| -rw-r--r-- | src/wx/email_dialog.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/wx/email_dialog.cc b/src/wx/email_dialog.cc index 97f974a90..b95d79b03 100644 --- a/src/wx/email_dialog.cc +++ b/src/wx/email_dialog.cc @@ -23,6 +23,7 @@ using std::string; using boost::shared_ptr; +using boost::optional; EmailDialog::EmailDialog (wxWindow* parent) : TableDialog (parent, _("Email address"), 2, 1, true) @@ -39,8 +40,14 @@ EmailDialog::set (string address) _email->SetValue (std_to_wx (address)); } -string +optional<string> EmailDialog::get () const { - return wx_to_std (_email->GetValue ()); + string s = wx_to_std (_email->GetValue ()); + if (s.empty ()) { + /* Invalid email address */ + return optional<string> (); + } + + return s; } |
