]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix bug with using invalid date in wxMSW wxCalendarCtrl.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 11 Jul 2012 11:42:39 +0000 (11:42 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 11 Jul 2012 11:42:39 +0000 (11:42 +0000)
Fall back to the start date of the native control if our own date was not set
yet.

Closes #14476.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72028 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/calctrl.cpp

index 7d80380b9389e6dbf6bddce66e1ba7dbd06c650f..6af1285b681b58171d227779fee0e1e81f5ad4c4 100644 (file)
@@ -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);