summaryrefslogtreecommitdiff
path: root/external/libcmis/libcmis-fix-error-handling.patch
blob: 09df7ac9ebe53eef682f0d3dba0817c33d40c8d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff -ur cmis.org/src/libcmis/xml-utils.cxx cmis/src/libcmis/xml-utils.cxx
--- cmis.org/src/libcmis/xml-utils.cxx	2016-12-09 02:19:47.900961750 +0100
+++ cmis/src/libcmis/xml-utils.cxx	2016-12-09 02:23:56.392206339 +0100
@@ -382,9 +382,14 @@
         // Get the time zone offset
         boost::posix_time::time_duration tzOffset( boost::posix_time::duration_from_string( "+00:00" ) );
 
+        if ( dateTimeStr.empty( ) )
+            return t; // obviously not a time
+
         size_t teePos = dateTimeStr.find( 'T' );
-        string noTzStr = dateTimeStr.substr( 0, teePos + 1 );
+        if ( teePos == string::npos )
+            return t; // obviously not a time
 
+        string noTzStr = dateTimeStr.substr( 0, teePos + 1 );
         string timeStr = dateTimeStr.substr( teePos + 1 );
 
         // Get the TZ if any