From b8401d2fb592b93cc16b54d3c1dab03f5a447a98 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Jul 2018 22:03:21 +0200 Subject: [PATCH] Fix return value of wxCalendarComboPopup::ParseDateTime() Don't pretend that empty string represents a valid date, this made no sense and resulted in unwanted events with an invalid date on clearing the text part of the generic wxDatePickerCtrl. --- src/generic/datectlg.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index f2a13d143a..94f5906fed 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -125,12 +125,9 @@ public: { wxASSERT(pDt); - if ( !s.empty() ) - { - pDt->ParseFormat(s, m_format); - if ( !pDt->IsValid() ) - return false; - } + pDt->ParseFormat(s, m_format); + if ( !pDt->IsValid() ) + return false; return true; } @@ -253,7 +250,7 @@ private: virtual void SetStringValue(const wxString& s) wxOVERRIDE { wxDateTime dt; - if ( !s.empty() && ParseDateTime(s, &dt) ) + if ( ParseDateTime(s, &dt) ) SetDate(dt); //else: keep the old value }