From d3d939ab7fc14f73d1bb20a6e84a4428e6cde24a Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 21 Jul 2010 21:54:36 -0700 Subject: Fix the case where no def is found for lookup. --- lang_ext/lua/upb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lang_ext/lua') 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; } -- cgit v1.2.3