Skip to content

Commit 9d2e892

Browse files
committed
修复因为FGUI框架导致的崩溃
1 parent 3e105a5 commit 9d2e892

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

emmy_debugger/src/emmy_debugger.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -418,29 +418,23 @@ void Debugger::GetVariable(std::shared_ptr<Variable> variable, int index, int de
418418
// metatable
419419
auto metatable = std::make_shared<Variable>();
420420
metatable->name = "(metatable)";
421-
metatable->nameType = LUA_TSTRING;
421+
metatable->nameType = lua_type(L, -1);
422422

423423
GetVariable(metatable, -1, depth - 1);
424424
variable->children.push_back(metatable);
425425

426426
//__index
427-
{
428-
lua_getfield(L, -1, "__index");
427+
if(lua_istable(L, -1)){
428+
// fix BUG 导致涉及到FGUI的框架崩溃
429+
lua_pushstring(L, "__index");
430+
lua_rawget(L, -2);
429431
if (!lua_isnil(L, -1))
430432
{
431433
auto v = std::make_shared<Variable>();
432434
v->name = "(metatable.__index)";
433-
v->nameType = LUA_TSTRING;
435+
v->nameType = lua_type(L, -1);
434436
GetVariable(v, -1, depth - 1);
435437
variable->children.push_back(v);
436-
// if (depth > 1)
437-
// {
438-
// for (auto child : v->children)
439-
// {
440-
// variable->children.push_back(child->Clone());
441-
// }
442-
// }
443-
// tableSize += v->children.size();
444438
}
445439
lua_pop(L, 1);
446440
}

0 commit comments

Comments
 (0)