[loader] Don't store through a null ptr (mono/mono#14110)
* [loader] Dont't store through a null ptr
If 'status' is null, don't try to write to it.
Fixes https://github.com/mono/mono/issues/13941
* [metadata] Protect writes to MonoImageOpenStatus* in a few places.
When possible assert that `MonoImageOpenStatus *status` arguments to various
functions in the runtime aren't null. There are a few places (MONO_API) where
it's possible that callers are passing null. In that case, use a local
MonoImageOpenStatus, or check for null before doing assignments.
Commit migrated from https://github.com/mono/mono/commit/
7ba1f77f6da6375bd941b6bac0bbab3bb30ddd6b