Null check modules on loadexec.

Should fix #6552.