We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6e3b017 commit 17a530eCopy full SHA for 17a530e
src/attributes.cpp
@@ -2357,8 +2357,12 @@ namespace attributes {
2357
// returns std::string::npos if no match is found
2358
size_t findComment(std::string const& str, size_t idx) {
2359
size_t firstSlash = str.find("/", idx);
2360
- if (str[firstSlash + 1] == '/') return firstSlash;
2361
- else return std::string::npos;
+ if (firstSlash != std::string::npos) {
+ if (firstSlash + 1 < str.length() && str[firstSlash + 1] == '/') {
2362
+ return firstSlash;
2363
+ }
2364
2365
+ return std::string::npos;
2366
}
2367
2368
// Remove trailing line comments -- ie, find comments that don't begin
0 commit comments