From kde-commits Wed Jun 15 13:50:08 2005 From: Will Stephenson Date: Wed, 15 Jun 2005 13:50:08 +0000 To: kde-commits Subject: KDE/kdepim/libkcal Message-Id: <1118843408.453014.6265.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=111884341931075 SVN commit 425750 by wstephens: ICalFormat::parseScheduleMessage() should guarantee that ( msg == 0 ) -> ( ICalFormat::exception() points to a valid Exception ). M +16 -4 icalformat.cpp M +1 -0 incidenceformatter.cpp --- trunk/KDE/kdepim/libkcal/icalformat.cpp #425749:425750 @@ -386,16 +386,27 @@ setTimeZone( cal->timeZoneId(), !cal->isLocalTime() ); clearException(); - if (messageText.isEmpty()) return 0; - + if (messageText.isEmpty()) + { + setException( new ErrorFormat( ErrorFormat::ParseErrorKcal, QString::fromLatin1( "messageText was empty, unable to parse into a ScheduleMessage" ) ) ); + return 0; + } icalcomponent *message; message = icalparser_parse_string(messageText.utf8()); - if (!message) return 0; + if (!message) + { + setException( new ErrorFormat( ErrorFormat::ParseErrorKcal, QString::fromLatin1( "icalparser was unable to parse messageText into a ScheduleMessage" ) ) ); + return 0; + } icalproperty *m = icalcomponent_get_first_property(message, ICAL_METHOD_PROPERTY); - if (!m) return 0; + if (!m) + { + setException( new ErrorFormat( ErrorFormat::ParseErrorKcal, QString::fromLatin1( "message didn't contain an ICAL_METHOD_PROPERTY" ) ) ); + return 0; + } icalcomponent *c; @@ -431,6 +442,7 @@ if (!incidence) { kdDebug(5800) << "ICalFormat:parseScheduleMessage: object is not a freebusy, event, todo or journal" << endl; + setException( new ErrorFormat( ErrorFormat::ParseErrorKcal, QString::fromLatin1( "object is not a freebusy, event, todo or journal" ) ) ); return 0; } --- trunk/KDE/kdepim/libkcal/incidenceformatter.cpp #425749:425750 @@ -891,6 +891,7 @@ if( !msg ) { kdDebug( 5850 ) << "Failed to parse the scheduling message" << endl; + Q_ASSERT( format.exception() ); kdDebug( 5850 ) << format.exception()->message() << endl; return QString::null; }