add some check on IME_TRIM_PRECHECK.
authorPeng Wu <epico@dhcp-65-116.nay.redhat.com>
Mon, 15 Mar 2010 10:00:30 +0000 (18:00 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 19 May 2010 02:09:31 +0000 (10:09 +0800)
lua/lua-plugin-init.c

index 7a1562f..8469cca 100644 (file)
@@ -57,7 +57,7 @@ static int ime_get_version(lua_State* L){
 }
 
 static gboolean ime_is_white_space(const char c){
-  const char * white_space = " \t\n\r\v\f";
+  static const char * const white_space = " \t\n\r\v\f";
   int i;
   size_t len = strlen(white_space);
   
@@ -69,7 +69,7 @@ static gboolean ime_is_white_space(const char c){
 }
 
 #define IME_TRIM_PRECHECK                       \
-  if (NULL == s){                               \
+  if (NULL == s || '\0' == s[0]){               \
   lua_pushliteral(L, "");                       \
   return 1;                                     \
   }