summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/m_icolib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirLua/src/m_icolib.cpp')
-rw-r--r--plugins/MirLua/src/m_icolib.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp
index 733fab90e0..eea44838d4 100644
--- a/plugins/MirLua/src/m_icolib.cpp
+++ b/plugins/MirLua/src/m_icolib.cpp
@@ -5,9 +5,13 @@ static int lua_AddIcon(lua_State *L)
const char *name = luaL_checkstring(L, 1);
ptrT description(mir_utf8decodeT(luaL_checkstring(L, 2)));
ptrT section(mir_utf8decodeT(luaL_optstring(L, 3, MODULE)));
+ ptrT filePath(mir_utf8decodeT(lua_tostring(L, 4)));
- TCHAR filePath[MAX_PATH];
- GetModuleFileName(g_hInstance, filePath, _countof(filePath));
+ if (filePath == NULL)
+ {
+ filePath = (TCHAR*)mir_calloc(MAX_PATH + 1);
+ GetModuleFileName(g_hInstance, filePath, MAX_PATH);
+ }
SKINICONDESC si = { 0 };
si.flags = SIDF_ALL_TCHAR;