From 96631a4b3b22aba8cd16a99ce1a81a64230dec5c Mon Sep 17 00:00:00 2001 From: byquanton <32410361+byquanton@users.noreply.github.com> Date: Sun, 24 Mar 2024 20:06:52 +0100 Subject: [PATCH] Fix a crash if no color is defined for a Caldav Project --- core/Objects/Project.vala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/Objects/Project.vala b/core/Objects/Project.vala index 3b9cb9572..a8a1750bf 100644 --- a/core/Objects/Project.vala +++ b/core/Objects/Project.vala @@ -324,7 +324,11 @@ public class Objects.Project : Objects.BaseObject { GXml.DomElement propstat = element.get_elements_by_tag_name ("d:propstat").get_element (0); GXml.DomElement prop = propstat.get_elements_by_tag_name ("d:prop").get_element (0); name = get_content (prop.get_elements_by_tag_name ("d:displayname").get_element (0)); - color = get_content (prop.get_elements_by_tag_name ("x1:calendar-color").get_element (0)); + + GXml.DomHTMLCollection colorElements = prop.get_elements_by_tag_name ("x1:calendar-color"); + if (colorElements.length > 0) { + color = get_content (colorElements.get_element (0)); + } GXml.DomHTMLCollection sync_token_collection = prop.get_elements_by_tag_name ("d:sync-token"); if (update_sync_token && sync_token_collection.length > 0) {