Refactor rst parsing for console output
[alexxy/gromacs.git] / src / gromacs / utility / stringutil.cpp
index dbcb951486f652c23680744fc9a30abef2ccd000..86abf82a085e9c370569609e6a6d188f994eb06f 100644 (file)
@@ -323,7 +323,11 @@ TextLineWrapper::formatLine(const std::string &input,
         --lineEnd;
     }
 
-    size_t      lineLength = lineEnd - lineStart;
+    const size_t lineLength = lineEnd - lineStart;
+    if (lineLength == 0)
+    {
+        return std::string();
+    }
     std::string result(indent, ' ');
     result.append(input, lineStart, lineLength);
     if (bContinuation && settings_.continuationChar_ != '\0')