X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/017dc06b502c041c112a3948e6c5f65000a86d94..30a7e91fb03558a4ffb6c5c6206ea25e53905e22:/src/msw/calctrl.cpp diff --git a/src/msw/calctrl.cpp b/src/msw/calctrl.cpp index 7d80380b93..ac0d8bbd76 100644 --- a/src/msw/calctrl.cpp +++ b/src/msw/calctrl.cpp @@ -3,7 +3,6 @@ // Purpose: wxCalendarCtrl implementation // Author: Vadim Zeitlin // Created: 2008-04-04 -// RCS-ID: $Id$ // Copyright: (C) 2008 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -474,7 +473,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);