Index: extensions/browser/file_highlighter.cc |
diff --git a/extensions/browser/file_highlighter.cc b/extensions/browser/file_highlighter.cc |
index 2cc669ee2f5f3161cb27348ecbd9caf79da479b8..37ac9d23c8205a63326a504ebc5634e2e6b20d55 100644 |
--- a/extensions/browser/file_highlighter.cc |
+++ b/extensions/browser/file_highlighter.cc |
@@ -113,8 +113,10 @@ ManifestHighlighter::ManifestHighlighter(const std::string& manifest, |
const std::string& key, |
const std::string& specific) |
: FileHighlighter(manifest) { |
- start_ = contents_.find('{') + 1; |
+ start_ = contents_.find('{'); |
+ start_ = start_ == std::string::npos ? contents_.size() : start_ + 1; |
Devlin
2016/08/17 15:14:03
nit: since we reassign start_ in all cases, I thin
Rafał Chłodnicki
2016/08/17 15:54:29
Let me just keep the current version. Proposed sty
|
end_ = contents_.rfind('}'); |
+ end_ = end_ == std::string::npos ? contents_.size() : end_; |
Parse(key, specific); |
} |
@@ -125,11 +127,11 @@ ManifestHighlighter::~ManifestHighlighter() { |
void ManifestHighlighter::Parse(const std::string& key, |
const std::string& specific) { |
// First, try to find the bounds of the full key. |
- if (FindBounds(key, true) /* enforce at top level */ ) { |
+ if (FindBounds(key, true) /* enforce at top level */) { |
// If we succeed, and we have a specific location, find the bounds of the |
// specific. |
if (!specific.empty()) |
- FindBounds(specific, false /* don't enforce at top level */ ); |
+ FindBounds(specific, false /* don't enforce at top level */); |
// We may have found trailing whitespace. Don't use base::TrimWhitespace, |
// because we want to keep any whitespace we find - just not highlight it. |