fixed bugs in the external extension system
import of external SDK that's been sitting around for a while --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401674
This commit is contained in:
@@ -235,6 +235,6 @@ void *SourceMod_Core::OnMetamodQuery(const char *iface, int *ret)
|
||||
*ret = (ptr == NULL) ? IFACE_FAILED : IFACE_OK;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ void CExtension::Initialize(const char *filename, const char *path)
|
||||
|
||||
CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filename, const char *path)
|
||||
{
|
||||
m_pAPI = pAPI;
|
||||
Initialize(filename, path);
|
||||
m_pAPI = pAPI;
|
||||
}
|
||||
|
||||
CLocalExtension::CLocalExtension(const char *filename)
|
||||
@@ -200,7 +200,13 @@ CExtension::~CExtension()
|
||||
|
||||
bool CExtension::PerformAPICheck(char *error, size_t maxlength)
|
||||
{
|
||||
if (!m_pAPI || m_pAPI->GetExtensionVersion() > SMINTERFACE_EXTENSIONAPI_VERSION)
|
||||
if (!m_pAPI)
|
||||
{
|
||||
snprintf(error, maxlength, "No IExtensionInterface instance provided");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_pAPI->GetExtensionVersion() > SMINTERFACE_EXTENSIONAPI_VERSION)
|
||||
{
|
||||
snprintf(error, maxlength, "Extension version is too new to load (%d, max is %d)", m_pAPI->GetExtensionVersion(), SMINTERFACE_EXTENSIONAPI_VERSION);
|
||||
return false;
|
||||
@@ -1281,3 +1287,4 @@ IExtension *CExtensionManager::LoadExternal(IExtensionInterface *pInterface,
|
||||
|
||||
return pExt;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user