From 05e5c93e9172f8368083e08d1ca7ac4999b25a58 Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Mon, 15 Aug 2011 19:30:56 +0100 Subject: [PATCH] Fail to load a metamod-enabled extension if it refuses to attach to MM:S (bug 5042, r=dvander). --- core/ExtensionSys.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/ExtensionSys.cpp b/core/ExtensionSys.cpp index 9cecd5d8..501374ef 100644 --- a/core/ExtensionSys.cpp +++ b/core/ExtensionSys.cpp @@ -182,6 +182,16 @@ bool CLocalExtension::Load(char *error, size_t maxlength) { bool already; m_PlId = g_pMMPlugins->Load(m_Path.c_str(), g_PLID, already, error, maxlength); + + // Check the plugin didn't refuse load + Pl_Status status; + if (!m_PlId || (g_pMMPlugins->Query(m_PlId, NULL, &status, NULL) && status < Pl_Paused)) + { + m_pLib->CloseLibrary(); + m_pLib = NULL; + m_pAPI = NULL; + return false; + } } if (!CExtension::Load(error, maxlength))