From b9431e88fb5a066b91b7b630ad926f77700f65cb Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Thu, 12 Apr 2018 14:57:56 -0700 Subject: [PATCH] fix(compiler): handle undefined annotation metadata (#23349) In certain cases seen in production, simplify() can returned undefined when simplifying decorator metadata. This has proven tricky to reproduce in an isolated test, but the fix is simple and low-risk: don't attempt to spread an undefined set of annotations in the first place. PR Close #23349 --- packages/compiler/src/aot/static_reflector.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/compiler/src/aot/static_reflector.ts b/packages/compiler/src/aot/static_reflector.ts index d8dd289192..dafdeef709 100644 --- a/packages/compiler/src/aot/static_reflector.ts +++ b/packages/compiler/src/aot/static_reflector.ts @@ -163,7 +163,9 @@ export class StaticReflector implements CompileReflector { let ownAnnotations: any[] = []; if (classMetadata['decorators']) { ownAnnotations = simplify(type, classMetadata['decorators']); - annotations.push(...ownAnnotations); + if (ownAnnotations) { + annotations.push(...ownAnnotations); + } } if (parentType && !this.summaryResolver.isLibraryFile(type.filePath) && this.summaryResolver.isLibraryFile(parentType.filePath)) {