diff --git a/src/main/java/com/google/api/generator/engine/ast/TryCatchStatement.java b/src/main/java/com/google/api/generator/engine/ast/TryCatchStatement.java index f1e063479f..3634374259 100644 --- a/src/main/java/com/google/api/generator/engine/ast/TryCatchStatement.java +++ b/src/main/java/com/google/api/generator/engine/ast/TryCatchStatement.java @@ -64,6 +64,9 @@ public abstract static class Builder { public TryCatchStatement build() { TryCatchStatement tryCatchStatement = autoBuild(); + NodeValidator.checkNoNullElements(tryCatchStatement.tryBody(), "try body", "try-catch"); + NodeValidator.checkNoNullElements(tryCatchStatement.catchBody(), "catch body", "try-catch"); + if (!tryCatchStatement.isSampleCode()) { Preconditions.checkNotNull( tryCatchStatement.catchVariableExpr(),