Commit 1ee8f554 authored by Dino Bollinger's avatar Dino Bollinger
Browse files

Duke3D: Fix crash when loading addon descriptors with no CFG present

Will now check if scriptfile is present when trying to load the addon
activation status or the load order from the config.
parent c9efd0f9
......@@ -1133,6 +1133,10 @@ int CONFIG_SetMapBestTime(uint8_t const * const mapmd4, int32_t tm)
int32_t CONFIG_GetAddonActivationStatus(const char* addonIdentifier)
{
int32_t status = 0;
if (!ud.config.setupread || ud.config.scripthandle < 0)
return status;
SCRIPT_GetBoolean(ud.config.scripthandle, "Active Addons", addonIdentifier, &status);
return status;
}
......@@ -1140,6 +1144,10 @@ int32_t CONFIG_GetAddonActivationStatus(const char* addonIdentifier)
int32_t CONFIG_GetAddonLoadOrder(const char* addonIdentifier)
{
int32_t loadOrder = -1;
if (!ud.config.setupread || ud.config.scripthandle < 0)
return loadOrder;
if (SCRIPT_GetNumber(ud.config.scripthandle, "TC Load Order", addonIdentifier, &loadOrder))
SCRIPT_GetNumber(ud.config.scripthandle, "Mod Load Order", addonIdentifier, &loadOrder);
return loadOrder;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment