diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-09-02 21:14:33 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-09-02 21:14:33 +0000 |
commit | 9c39d74383197c1848a47b81831b08326c8f0884 (patch) | |
tree | 8c298ec11f981b21775583031fdd82a3363d95f0 /plugins/MirLua | |
parent | e70895affa823bfe0f61174f4e14a983fda4ea0f (diff) |
MirLua: more correct version of previous commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@15162 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua')
-rw-r--r-- | plugins/MirLua/src/m_genmenu.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 25f0da5803..c8f57691f9 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -14,12 +14,16 @@ void MakeMenuItem(lua_State *L, CMenuItem &mi) lua_pushliteral(L, "Uid");
lua_gettable(L, -2);
- unsigned long a;
- unsigned short b, c;
- unsigned char d[8];
- if (sscanf_s((char*)luaL_checkstring(L, -1), "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
- &a, &b, &c, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7]))
- SET_UID(mi, a, b, c, d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7]);
+ const char* uuid = (char*)lua_tostring(L, -1);
+ if (uuid)
+ {
+ unsigned long a;
+ unsigned short b, c;
+ unsigned char d[8];
+ if (sscanf_s(uuid, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+ &a, &b, &c, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7]) == 11)
+ SET_UID(mi, a, b, c, d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7]);
+ }
lua_pop(L, 1);
lua_pushliteral(L, "Name");
|