gn: Don't read unitialized memory on files containing just a comment.

The BlockNode::GetRange() of a block containing nothing doesn't have
an initialized bytes_ member.  Skip empty nodes, they'll be assinged
to the file block further down.

Patch sketch by scottmg.

BUG=640856

Review-Url: https://codereview.chromium.org/2271383003
Cr-Original-Commit-Position: refs/heads/master@{#414522}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c3b455922b7ddb748e9a7b351cac7a4586c7e374
diff --git a/tools/gn/parser.cc b/tools/gn/parser.cc
index 41ee6b6..e256d2d 100644
--- a/tools/gn/parser.cc
+++ b/tools/gn/parser.cc
@@ -454,7 +454,7 @@
 }
 
 std::unique_ptr<ParseNode> Parser::Block(Token token) {
-  // This entrypoing into ParseBlock means its part of an expression and we
+  // This entrypoint into ParseBlock means it's part of an expression and we
   // always want the result.
   return ParseBlock(token, BlockNode::RETURNS_SCOPE);
 }
@@ -820,6 +820,10 @@
   // Assign line comments to syntax immediately following.
   int cur_comment = 0;
   for (auto* node : pre) {
+    if (node->GetRange().is_null()) {
+      CHECK_EQ(node, file) << "Only expected on top file node";
+      continue;
+    }
     const Location& start = node->GetRange().begin();
     while (cur_comment < static_cast<int>(line_comment_tokens_.size())) {
       if (start.byte() >= line_comment_tokens_[cur_comment].location().byte()) {