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

Unified Diff: tools/gn/command_format.cc

Issue 608593006: gn format: don't crash when there's no block on a function call (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-format-list-end
Patch Set: trailing space Created 6 years, 3 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 | « no previous file | tools/gn/command_format_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_format.cc
diff --git a/tools/gn/command_format.cc b/tools/gn/command_format.cc
index cd10e3c5fe5b677cf0e9ebffbcd460f375c30a1f..d96e6a330fa39b1b2fc235d3d11ca990badf7ad9 100644
--- a/tools/gn/command_format.cc
+++ b/tools/gn/command_format.cc
@@ -242,10 +242,12 @@ Printer::ExprStyle Printer::Expr(const ParseNode* root) {
Sequence(kSequenceStyleFunctionCall,
func_call->args()->contents(),
func_call->args()->End());
- Print(" ");
- Sequence(kSequenceStyleBracedBlock,
- func_call->block()->statements(),
- func_call->block()->End());
+ if (func_call->block()) {
+ Print(" ");
+ Sequence(kSequenceStyleBracedBlock,
+ func_call->block()->statements(),
+ func_call->block()->End());
+ }
} else if (const IdentifierNode* identifier = root->AsIdentifier()) {
Print(identifier->value().value());
} else if (const ListNode* list = root->AsList()) {
« no previous file with comments | « no previous file | tools/gn/command_format_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698