From fec90573f31e407eb251fcc8a3a08ca89fa85f3b Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 23 Jan 2016 13:34:01 +0000 Subject: [PATCH] Improved checking for DTSTAMP and UID for ValidObject in CalendarEvent. --- .../objects/calendarevent/CalendarEvent.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/source/objects/calendarevent/CalendarEvent.cpp b/source/objects/calendarevent/CalendarEvent.cpp index 6c1887d..d175eed 100644 --- a/source/objects/calendarevent/CalendarEvent.cpp +++ b/source/objects/calendarevent/CalendarEvent.cpp @@ -9,6 +9,7 @@ CalendarObjectValidResult CalendarEventObject::ValidObject(){ bool ValidDateTimeStamp = false; bool ValidUniqueID = false; int SeekCount = 0; + string PropertyName; // Look for BEGIN:VEVENT. @@ -44,8 +45,16 @@ CalendarObjectValidResult CalendarEventObject::ValidObject(){ for (vector::iterator iter = ObjectName.begin(); iter != ObjectName.end(); iter++){ - - if (ObjectName[SeekCount] == "DTSTAMP"){ + + try{ + PropertyName = ObjectName[SeekCount].substr(0,7); + } + + catch(const out_of_range& oor){ + continue; + } + + if (PropertyName == "DTSTAMP"){ if (ValidDateTimeStamp == false){ ValidDateTimeStamp = true; @@ -66,7 +75,15 @@ CalendarObjectValidResult CalendarEventObject::ValidObject(){ for (vector::iterator iter = ObjectName.begin(); iter != ObjectName.end(); iter++){ - if (ObjectName[SeekCount] == "UID"){ + try{ + PropertyName = ObjectName[SeekCount].substr(0,3); + } + + catch(const out_of_range& oor){ + continue; + } + + if (PropertyName == "UID"){ if (ValidUniqueID == false){ ValidUniqueID = true; -- 2.39.5