src/corelib/tools/qregexp.cpp
changeset 30 5dc02b23752f
parent 19 fcece45ef507
--- a/src/corelib/tools/qregexp.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/corelib/tools/qregexp.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -1466,9 +1466,14 @@
 #ifndef QT_NO_REGEXP_CAPTURE
         for (int i = 0; i < numCaptures; ++i) {
             int j = eng->captureForOfficialCapture.at(i);
-            int len = capEnd[j] - capBegin[j];
-            *c++ = (len > 0) ? pos + capBegin[j] : 0;
-            *c++ = len;
+            if (capBegin[j] != EmptyCapture) {
+                int len = capEnd[j] - capBegin[j];
+                *c++ = (len > 0) ? pos + capBegin[j] : 0;
+                *c++ = len;
+            } else {
+                *c++ = -1;
+                *c++ = -1;
+            }
         }
 #endif
     } else {
@@ -4454,7 +4459,7 @@
 
     Writes the regular expression \a regExp to stream \a out.
 
-    \sa {Format of the QDataStream Operators}
+    \sa {Serializing Qt Data Types}
 */
 QDataStream &operator<<(QDataStream &out, const QRegExp &regExp)
 {
@@ -4468,7 +4473,7 @@
 
     Reads a regular expression from stream \a in into \a regExp.
 
-    \sa {Format of the QDataStream Operators}
+    \sa {Serializing Qt Data Types}
 */
 QDataStream &operator>>(QDataStream &in, QRegExp &regExp)
 {