]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/calctrl.cpp
Fix incorrect event handler functions casts in wxRibbonPanel code.
[wxWidgets.git] / src / msw / calctrl.cpp
index 7d80380b9389e6dbf6bddce66e1ba7dbd06c650f..ac0d8bbd7600db54373a107f49b6bab689a4df53 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxCalendarCtrl implementation
 // Author:      Vadim Zeitlin
 // Created:     2008-04-04
-// RCS-ID:      $Id$
 // Copyright:   (C) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
 // 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);