diff --git a/interface/wx/calctrl.h b/interface/wx/calctrl.h index 40bd51493d..a756e458e3 100644 --- a/interface/wx/calctrl.h +++ b/interface/wx/calctrl.h @@ -469,7 +469,8 @@ public: The @a date parameter must be valid and in the currently valid range as set by SetDateRange(), otherwise the current date is not changed and - the function returns @false. + the function returns @false and, additionally, triggers an assertion + failure if the date is invalid. */ virtual bool SetDate(const wxDateTime& date); diff --git a/src/generic/calctrlg.cpp b/src/generic/calctrlg.cpp index 58875a3066..3c5b8ce4e9 100644 --- a/src/generic/calctrlg.cpp +++ b/src/generic/calctrlg.cpp @@ -434,6 +434,8 @@ bool wxGenericCalendarCtrl::EnableMonthChange(bool enable) bool wxGenericCalendarCtrl::SetDate(const wxDateTime& date) { + wxCHECK_MSG( date.IsValid(), false, "invalid date" ); + bool retval = true; bool sameMonth = m_date.GetMonth() == date.GetMonth(), diff --git a/src/gtk/calctrl.cpp b/src/gtk/calctrl.cpp index 221fa53ef5..fbeb93edf8 100644 --- a/src/gtk/calctrl.cpp +++ b/src/gtk/calctrl.cpp @@ -198,7 +198,9 @@ bool wxGtkCalendarCtrl::EnableMonthChange(bool enable) bool wxGtkCalendarCtrl::SetDate(const wxDateTime& date) { - if ( date.IsValid() && !IsInValidRange(date) ) + wxCHECK_MSG( date.IsValid(), false, "invalid date" ); + + if ( !IsInValidRange(date) ) return false; g_signal_handlers_block_by_func(m_widget,