Avoid calling OnUnload twice.

This commit is contained in:
Dr. Chat 2015-07-06 19:19:32 -05:00
parent 0388d17a72
commit b2241e3fef
1 changed files with 9 additions and 4 deletions

View File

@ -112,12 +112,17 @@ X_STATUS XUserModule::LoadFromMemory(const void* addr, const size_t length) {
}
X_STATUS XUserModule::Unload() {
if (!xex_module()->Unload()) {
return X_STATUS_UNSUCCESSFUL;
if (!xex_module()->loaded()) {
// Quick abort.
return X_STATUS_SUCCESS;
}
OnUnload();
return X_STATUS_SUCCESS;
if (xex_module()->Unload()) {
OnUnload();
return X_STATUS_SUCCESS;
}
return X_STATUS_UNSUCCESSFUL;
}
uint32_t XUserModule::GetProcAddressByOrdinal(uint16_t ordinal) {