From 5f0ccfaff4f98e7bc386c45ac97cbde871463ed6 Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Tue, 21 Oct 2008 23:21:54 +0200 Subject: [PATCH] Make using dependency() on non class return types a nop. It would fail with an assertion if used on functions with non-class return types. This was a problem for iterator_policy, which turns the return value into a c-closure. --- luabind/dependency_policy.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/luabind/dependency_policy.hpp b/luabind/dependency_policy.hpp index 7c1245c..cafa49a 100644 --- a/luabind/dependency_policy.hpp +++ b/luabind/dependency_policy.hpp @@ -40,7 +40,10 @@ namespace luabind { namespace detail int patient = indices[B]; object_rep* nurse = static_cast(lua_touserdata(L, nurse_index)); - assert((nurse != 0) && "internal error, please report"); // internal error + + // If the nurse isn't an object_rep, just make this a nop. + if (nurse == 0) + return; nurse->add_dependency(L, patient); } -- 2.11.4.GIT