diff options
author | Joshua Haberman <joshua@reverberate.org> | 2010-07-21 21:54:36 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2010-07-21 21:54:36 -0700 |
commit | d3d939ab7fc14f73d1bb20a6e84a4428e6cde24a (patch) | |
tree | 8e3d9a3ddb8e6cd3278e5b7f78c05e3bcc48c9fa /lang_ext | |
parent | 21ee24a7300dbdabef707457d2407b4f9187603b (diff) |
Fix the case where no def is found for lookup.
Diffstat (limited to 'lang_ext')
-rw-r--r-- | lang_ext/lua/upb.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lang_ext/lua/upb.c b/lang_ext/lua/upb.c index a16a187..a8165c7 100644 --- a/lang_ext/lua/upb.c +++ b/lang_ext/lua/upb.c @@ -187,7 +187,11 @@ static int lupb_symtab_lookup(lua_State *L) { const char *name = luaL_checklstring(L, 2, &len); upb_string namestr = UPB_STACK_STRING_LEN(name, len); upb_def *def = upb_symtab_lookup(s->symtab, &namestr); - lupb_def_getorcreate(L, def); + if (def) { + lupb_def_getorcreate(L, def); + } else { + lua_pushnil(L); + } return 1; } |