summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 53fb15dbeb..756863f8f9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -990,6 +990,8 @@ trait Namers { self: Analyzer =>
val module = companionModuleOf(meth.owner, context)
module.initialize // call type completer (typedTemplate), adds the
// module's templateNamer to classAndNamerOfModule
+ if (!classAndNamerOfModule.contains(module))
+ return // fix #3649 (prevent crash in erroneous source code)
val (cdef, nmr) = classAndNamerOfModule(module)
moduleNamer = Some(cdef, nmr)
(cdef, nmr)