From 2c6c9054e3f9ae00498fc2b56331a17b590ab74e Mon Sep 17 00:00:00 2001 From: Evan Wies Date: Fri, 30 Oct 2009 09:51:32 +0100 Subject: [PATCH] Don't crash if class_info() is called on non-luabind objects. --- src/class_info.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/class_info.cpp b/src/class_info.cpp index 3733878..57b5260 100755 --- a/src/class_info.cpp +++ b/src/class_info.cpp @@ -35,7 +35,18 @@ namespace luabind o.push(L); detail::object_rep* obj = detail::is_class_object(L, -1); - lua_pop(L, 1); + + if (!obj) + { + class_info result; + result.name = lua_typename(L, -1); + lua_pop(L, 1); + result.methods = newtable(L); + result.attributes = newtable(L); + return result; + } + + lua_pop(L, 1); obj->crep()->get_table(L); object table(from_stack(L, -1)); -- 2.11.4.GIT