Fix error state shutdown crash.

This commit is contained in:
Ben Vanik 2015-11-06 16:27:07 -08:00
parent 35a9697af7
commit 440c807936
1 changed files with 4 additions and 2 deletions

View File

@ -142,12 +142,14 @@ X_STATUS UserModule::LoadFromMemory(const void* addr, const size_t length) {
}
X_STATUS UserModule::Unload() {
if (module_format_ == kModuleFormatXex && !xex_module()->loaded()) {
if (module_format_ == kModuleFormatXex &&
(!processor_module_ || !xex_module()->loaded())) {
// Quick abort.
return X_STATUS_SUCCESS;
}
if (module_format_ == kModuleFormatXex && xex_module()->Unload()) {
if (module_format_ == kModuleFormatXex && processor_module_ &&
xex_module()->Unload()) {
OnUnload();
return X_STATUS_SUCCESS;
}