Quick fix for ScalaLanguageLevel crashing with External build compiler

ScalaLanguageLevel.getLanguageLevel(element) would crash if 
element.getContainingFile.getVirtualFile was null. This would pretty
much kill any Completion/Highlighting processes that touched it, as
in this bug report against Completion:

http://youtrack.jetbrains.com/issue/SCL-5108

I think getVirtualFile() is supposed to return null iff the file
exists only in memory, however this was occurring for me with Scala
0.7.62/IU-123.94 on concrete *.scala source files - but *only* when
the 'Use External build' was enabled (presumably because having the
files compiled in an external process somehow leads to the PSI not
pointing to the physical *.scala files in some way.

Is there a better way to get from a PsiFile to a Module?

http://blog.jetbrains.com/scala/2012/12/28/a-new-way-to-compile/