From 6ed8c3b909db587870c6b1057c8fc5da89d2066a Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 18 May 2019 14:44:10 +0200 Subject: [PATCH] lua:avoid segfault --- src/gui/lua/lua_menue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/lua/lua_menue.cpp b/src/gui/lua/lua_menue.cpp index 85b027ef9..237cb4fc0 100644 --- a/src/gui/lua/lua_menue.cpp +++ b/src/gui/lua/lua_menue.cpp @@ -433,7 +433,7 @@ int CLuaInstMenu::MenuAddItem(lua_State *L) const char *val = lua_tostring(L, -2); kext[j].key = atoi(key); kext[j].value = NONEXISTANT_LOCALE; - kext[j].valname = strdup(val); + kext[j].valname = strdup(val?val:"ERROR"); D->tofree.push_back((void *)kext[j].valname); if (!strcmp(value.c_str(), kext[j].valname)) b->int_val = kext[j].key;