[folks] eds: Fix crash on handling invalid birthday dates from contacts
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] eds: Fix crash on handling invalid birthday dates from contacts
- Date: Mon, 21 Apr 2014 16:42:17 +0000 (UTC)
commit 5e82482a31915215cb365605654dd11a92ba9664
Author: Philip Withnall <philip tecnocode co uk>
Date: Sun Apr 20 21:03:16 2014 +0100
eds: Fix crash on handling invalid birthday dates from contacts
If a GDateTime cannot be constructed due to the requested date being
invalid or out of range, the constructor will return null. The code was
not previously handling this.
https://bugzilla.gnome.org/show_bug.cgi?id=727944
NEWS | 2 ++
backends/eds/lib/edsf-persona.vala | 7 +++++--
2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 951f666..2e54ffb 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,8 @@ Bugs fixed:
• Bug 722579 — Contacts are displayed for Google accounts where contact
management is disabled in GOA
• Bug 705742 — Implement rate limiting in AvatarCache.store_avatar()
+ • Bug 727944 — crash during Empathy startup: segfault in g_date_time_to_utc
+ from _edsf_persona_update
API changes:
• Add Individual.display_name
diff --git a/backends/eds/lib/edsf-persona.vala b/backends/eds/lib/edsf-persona.vala
index 1dd3c89..718fe82 100644
--- a/backends/eds/lib/edsf-persona.vala
+++ b/backends/eds/lib/edsf-persona.vala
@@ -1176,9 +1176,12 @@ public class Edsf.Persona : Folks.Persona,
* /etc/localtime, which means lots of syscalls. */
var d = new DateTime (Persona._local_time_zone,
(int) bday.year, (int) bday.month, (int) bday.day, 0, 0, 0.0);
- if (this._birthday == null ||
+
+ /* d might be null if their birthday in e-d-s is something that
+ * doesn't make sense, like 31st February. If so, ignore it. */
+ if (d != null && (this._birthday == null ||
(this._birthday != null &&
- !((!) this._birthday).equal (d.to_utc ())))
+ !((!) this._birthday).equal (d.to_utc ()))))
{
this._birthday = d.to_utc ();
this.notify_property ("birthday");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]