diff --git a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart index 170d16d07dc..7cffc44de5b 100644 --- a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart +++ b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart @@ -81,11 +81,13 @@ class RuntimeTypeGenerator { if (!method.isAbstract) { ClosureClassMap closureData = compiler.closureToClassMapper .getClosureToClassMapping(method.resolvedAst); - ClosureFieldElement thisLocal = - closureData.freeVariableMap[closureData.thisLocal]; - if (thisLocal != null) { - jsAst.Name thisName = namer.instanceFieldPropertyName(thisLocal); - thisAccess = js('this.#', thisName); + if (closureData != null) { + ClosureFieldElement thisLocal = + closureData.freeVariableMap[closureData.thisLocal]; + if (thisLocal != null) { + jsAst.Name thisName = namer.instanceFieldPropertyName(thisLocal); + thisAccess = js('this.#', thisName); + } } }