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() { X_STATUS XUserModule::Unload() {
if (!xex_module()->Unload()) { if (!xex_module()->loaded()) {
return X_STATUS_UNSUCCESSFUL; // Quick abort.
return X_STATUS_SUCCESS;
} }
OnUnload(); if (xex_module()->Unload()) {
return X_STATUS_SUCCESS; OnUnload();
return X_STATUS_SUCCESS;
}
return X_STATUS_UNSUCCESSFUL;
} }
uint32_t XUserModule::GetProcAddressByOrdinal(uint16_t ordinal) { uint32_t XUserModule::GetProcAddressByOrdinal(uint16_t ordinal) {