lm_message.c
changeset 37 6e425a8e245e
parent 23 13f03e604c8a
child 38 34a2b880615c
--- 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)