2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-15 08:08:08 +03:00

Fix crash with old version rehlds

This commit is contained in:
s1lentq 2024-05-21 01:47:39 +07:00
parent 2cb688cf23
commit 06743d6eb9

View File

@ -77,12 +77,16 @@ bool RehldsApi_Init()
g_RehldsSvs = g_RehldsApi->GetServerStatic(); g_RehldsSvs = g_RehldsApi->GetServerStatic();
g_RehldsMessageManager = nullptr; g_RehldsMessageManager = nullptr;
// message manager is available in "ReHLDS API" >= 3.14
if (majorVersion >= 3 && minorVersion >= 14)
{
IMessageManager *messageManager = g_RehldsApi->GetMessageManager(); IMessageManager *messageManager = g_RehldsApi->GetMessageManager();
if (messageManager->getMajorVersion() == MESSAGEMNGR_VERSION_MAJOR && if (messageManager->getMajorVersion() == MESSAGEMNGR_VERSION_MAJOR &&
messageManager->getMinorVersion() >= MESSAGEMNGR_VERSION_MINOR) messageManager->getMinorVersion() >= MESSAGEMNGR_VERSION_MINOR)
{ {
g_RehldsMessageManager = messageManager; g_RehldsMessageManager = messageManager;
} }
}
return true; return true;
} }