[glibmm] Check for invalid date in Glib::Date copy constructor.



commit 5bd4921c2020737e0399712630e23fd85039ef62
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Mon Jun 22 12:12:53 2009 -0400

    Check for invalid date in Glib::Date copy constructor.

 ChangeLog         |    5 +++++
 glib/src/date.ccg |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 535ac5b..132cffa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-22  José Alburquerque  <jaalburqu svn gnome org>
+
+	* glib/src/date.ccg: Check for an invalid date in copy constructor and
+	assignment operator.  Fixes bug #585027.
+
 2009-06-19  Jonathon Jongsma  <jonathon quotidian org>
 
 	Add start of Socket class
diff --git a/glib/src/date.ccg b/glib/src/date.ccg
index fff0a1e..3bd6697 100644
--- a/glib/src/date.ccg
+++ b/glib/src/date.ccg
@@ -59,12 +59,13 @@ Date::Date(const GDate& castitem)
 Date::Date(const Date& other)
 {
   g_date_clear(&gobject_, 1);
-  g_date_set_julian(&gobject_, other.get_julian());
+  if (g_date_valid(&other.gobject_))
+    g_date_set_julian(&gobject_, other.get_julian());
 }
 
 Date& Date::operator=(const Date& other)
 {
-  if (&other != this)
+  if (&other != this && g_date_valid(&other.gobject_))
     g_date_set_julian(&gobject_, other.get_julian());
 
   return *this;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]