Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2057)

Unified Diff: tools/gn/tokenizer.cc

Issue 1275853006: Fix some crashes in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/parser_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/tokenizer.cc
diff --git a/tools/gn/tokenizer.cc b/tools/gn/tokenizer.cc
index be3223b5e145e48bfc4db5dc6311f88856557b70..db10f6ae094946c11b659aca6dea43f207459f61 100644
--- a/tools/gn/tokenizer.cc
+++ b/tools/gn/tokenizer.cc
@@ -128,7 +128,8 @@ std::vector<Token> Tokenizer::Run() {
location.line_number() ||
tokens_.back().location().char_offset() != location.char_offset())) {
type = Token::LINE_COMMENT;
- Advance(); // The current \n.
+ if (!at_end()) // Could be EOF.
+ Advance(); // The current \n.
// If this comment is separated from the next syntax element, then we
// want to tag it as a block comment. This will become a standalone
// statement at the parser level to keep this comment separate, rather
« no previous file with comments | « tools/gn/parser_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698