Fix some bugs

- addr2line backtrace should continue on eintr
- lua crashes if we try to iterate a non-table
This commit is contained in:
Justine Tunney 2022-04-27 20:18:34 -07:00
parent 6a145a9262
commit cc0d1ec076
3 changed files with 22 additions and 10 deletions

View file

@ -140,18 +140,20 @@ void lua_readline_completions (const char *p, linenoiseCompletions *c) {
}
// search final object
lua_pushnil(L);
while (lua_next(L, -2)) {
if (lua_type(L, -2) == LUA_TSTRING) {
name = lua_tostring(L, -2);
if (startswithi(name, a)) {
lua_readline_addcompletion(c, xasprintf("%.*s%s", a - p, p, name));
if (lua_type(L, -1) == LUA_TTABLE) {
lua_pushnil(L);
while (lua_next(L, -2)) {
if (lua_type(L, -2) == LUA_TSTRING) {
name = lua_tostring(L, -2);
if (startswithi(name, a)) {
lua_readline_addcompletion(c, xasprintf("%.*s%s", a - p, p, name));
}
}
lua_pop(L, 1);
}
lua_pop(L, 1);
}
lua_pop(L, 1);
lua_pop(L, 1); // pop table
for (i = 0; i < ARRAYLEN(kKeywordHints); ++i) {
if (startswithi(kKeywordHints[i], p)) {