Fix a NullReferenceException: Modules can exist without an Assembly

"method.DeclaringType.Module.Assembly.EntryPoint"
causes a NullReferenceException as Assembly == null.
This change first checks if Module.Assembly != null.

A module without Assembly can be created by 
assemblyBuilder.DefineDynamicModule("modulName", "filename.dll", true);