diff options
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index b1c1d2401b7..bfeeb2d2134 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1871,7 +1871,25 @@ Slice::Unit::setComment(const string& comment) } end = comment.find('\n', begin); - _currentComment += comment.substr(begin, end - begin + 1); + if (end != string::npos) + { + if (end + 1 > begin) + { + _currentComment += comment.substr(begin, end + 1 - begin); + } + } + else + { + end = comment.find_last_not_of(" \t\r\n*"); + if (end != string::npos) + { + if (end + 1 > begin) + { + _currentComment += comment.substr(begin, end + 1 - begin); + } + } + break; + } } } |