Skip to content

Commit

Permalink
Fix crash with old version rehlds
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed May 20, 2024
1 parent 2cb688c commit 06743d6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions reapi/src/mods/mod_rehlds_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,15 @@ bool RehldsApi_Init()
g_RehldsSvs = g_RehldsApi->GetServerStatic();
g_RehldsMessageManager = nullptr;

IMessageManager *messageManager = g_RehldsApi->GetMessageManager();
if (messageManager->getMajorVersion() == MESSAGEMNGR_VERSION_MAJOR &&
messageManager->getMinorVersion() >= MESSAGEMNGR_VERSION_MINOR)
// message manager is available in "ReHLDS API" >= 3.14
if (majorVersion >= 3 && minorVersion >= 14)
{
g_RehldsMessageManager = messageManager;
IMessageManager *messageManager = g_RehldsApi->GetMessageManager();
if (messageManager->getMajorVersion() == MESSAGEMNGR_VERSION_MAJOR &&
messageManager->getMinorVersion() >= MESSAGEMNGR_VERSION_MINOR)
{
g_RehldsMessageManager = messageManager;
}
}

return true;
Expand Down

0 comments on commit 06743d6

Please sign in to comment.