Sfoglia il codice sorgente

fix: rotable读取到不存在的名称时有可能挂

Wendal Chen 4 anni fa
parent
commit
a1ac00342a
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      lua/src/rotable.c

+ 1 - 1
lua/src/rotable.c

@@ -102,7 +102,7 @@ static int rotable_func_index( lua_State* L ) {
   }
   else {
     // 看看第一个方法是不是__index, 如果是的话, 调用之
-    if (p2->name != NULL && !strcmp("__index", p->name)) {
+    if (p2->name != NULL && !strcmp("__index", p2->name)) {
       lua_pushcfunction(L, p2->func);
       lua_pushvalue(L, 2);
       lua_call(L, 1, 1);