X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Femail_dialog.cc;h=b95d79b03ba83174c72e091eb21635d9b83ff28b;hb=3dfe3b92df03eee932f3c92336197559c11a5913;hp=97f974a90050a17699c0bcb22d2eacacf815e6d3;hpb=3828baf56467224f5d44049bf1e7a7ed11f43a05;p=dcpomatic.git 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 EmailDialog::get () const { - return wx_to_std (_email->GetValue ()); + string s = wx_to_std (_email->GetValue ()); + if (s.empty ()) { + /* Invalid email address */ + return optional (); + } + + return s; }