Index: src/sksl/SkSLParser.cpp |
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp |
index 9e3e84784bfbc937d408d8a7b341e43c86fa50a8..d011d46947066d2e55a3485d4203a870f5301e2e 100644 |
--- a/src/sksl/SkSLParser.cpp |
+++ b/src/sksl/SkSLParser.cpp |
@@ -808,17 +808,26 @@ std::unique_ptr<ASTForStatement> Parser::forStatement() { |
case Token::SEMICOLON: |
this->nextToken(); |
break; |
- case Token::CONST: |
+ case Token::CONST: { |
+ std::unique_ptr<ASTVarDeclarations> vd = this->varDeclarations(); |
+ if (!vd) { |
+ return nullptr; |
+ } |
initializer = std::unique_ptr<ASTStatement>(new ASTVarDeclarationStatement( |
- this->varDeclarations())); |
+ std::move(vd))); |
break; |
- case Token::IDENTIFIER: |
+ } |
+ case Token::IDENTIFIER: { |
if (this->isType(nextToken.fText)) { |
+ std::unique_ptr<ASTVarDeclarations> vd = this->varDeclarations(); |
+ if (!vd) { |
+ return nullptr; |
+ } |
initializer = std::unique_ptr<ASTStatement>(new ASTVarDeclarationStatement( |
- this->varDeclarations())); |
+ std::move(vd))); |
break; |
} |
- // fall through |
+ } // fall through |
default: |
initializer = this->expressionStatement(); |
} |