X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/017dc06b502c041c112a3948e6c5f65000a86d94..51248412979029d94d11ea5dab9516831be94914:/src/msw/calctrl.cpp diff --git a/src/msw/calctrl.cpp b/src/msw/calctrl.cpp index 7d80380b93..6af1285b68 100644 --- a/src/msw/calctrl.cpp +++ b/src/msw/calctrl.cpp @@ -474,7 +474,9 @@ bool wxCalendarCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxDateTime startDate; startDate.SetFromMSWSysDate(ds->stStart); - wxDateTime currentDate = m_date; + // Ensure we have a valid date to work with. + wxDateTime currentDate = m_date.IsValid() ? m_date : startDate; + // Set to the start of month for comparison with startDate to // work correctly. currentDate.SetDay(1);