# HG changeset patch # User Myhailo Danylenko # Date 1309538790 -10800 # Node ID 6e425a8e245e8b0e31544ef27c4cd1493754d963 # Parent 41df6f2a7aa8b07449a7971ffbdd3f974ac2f30c Fixed segfault in message.create if mtype is not specified diff -r 41df6f2a7aa8 -r 6e425a8e245e lm_message.c --- a/lm_message.c Sun Jun 26 19:59:28 2011 +0300 +++ b/lm_message.c Fri Jul 01 19:46:30 2011 +0300 @@ -177,14 +177,15 @@ static int create_lm_message (lua_State *L) { const char *mtype; - const char *st; + const char *st = NULL; const char *to = NULL; LmMessage *message; luaL_checktype (L, 1, LUA_TTABLE); lua_getfield (L, 1, "mtype"); mtype = lua_tostring (L, -1); - st = strchr (mtype, '-'); + if (mtype) + st = strchr (mtype, '-'); lua_getfield (L, 1, "to"); if (lua_type (L, -1) == LUA_TSTRING)