From 5133915e9cdd89cf47aefb2e193ea0510df66b90 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Fri, 17 Sep 2004 18:33:15 +0000 Subject: [PATCH] Fixed crashbug in get_module: if a not-new-api or bad-file module didn't load, it crashed --- amxmodx/amxmodx.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 49596dff..390629ec 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -2304,16 +2304,16 @@ static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params) if ((*moduleIter).isAmxx()) { const amxx_module_info_s *info = (*moduleIter).getInfoNew(); - set_amxstring(amx, params[2], info->name, params[3]); - set_amxstring(amx, params[4], info->author, params[5]); - set_amxstring(amx, params[6], info->version, params[7]); + set_amxstring(amx, params[2], info && info->name ? info->name : "unk", params[3]); + set_amxstring(amx, params[4], info && info->author ? info->author : "unk", params[5]); + set_amxstring(amx, params[6], info && info->version ? info->version : "unk", params[7]); } else { module_info_s *info = (*moduleIter).getInfo(); - set_amxstring(amx, params[2], info->name, params[3]); - set_amxstring(amx, params[4], info->author, params[5]); - set_amxstring(amx, params[6], info->version, params[7]); + set_amxstring(amx, params[2], info && info->name ? info->name : "unk", params[3]); + set_amxstring(amx, params[4], info && info->author ? info->author : "unk", params[5]); + set_amxstring(amx, params[6], info && info->version ? info->version : "unk", params[7]); } // compatibility problem possible