From 09d47e7f55bca5142db676c514c4cb6ccd95eb33 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sat, 22 Mar 2014 13:23:21 +0100 Subject: [PATCH] cppbind: fix problem with function call without arguments. --- .../cppbind/detail/from_nasal_function_templates.hxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/simgear/nasal/cppbind/detail/from_nasal_function_templates.hxx b/simgear/nasal/cppbind/detail/from_nasal_function_templates.hxx index 6b788122..83f1216b 100644 --- a/simgear/nasal/cppbind/detail/from_nasal_function_templates.hxx +++ b/simgear/nasal/cppbind/detail/from_nasal_function_templates.hxx @@ -21,13 +21,16 @@ BOOST_PP_ENUM_TRAILING(n, SG_CALL_TRAITS_PARAM, 0) ) { naContext ctx = naNewContext(); - naRef args[] = { +#if n + naRef args[n] = { BOOST_PP_ENUM(n, SG_CALL_ARG, 0) }; - const int num_args = sizeof(args)/sizeof(args[0]); +#else + naRef* args = NULL; +#endif naRef result = - naCallMethodCtx(ctx, holder->get_naRef(), self, num_args, args, naNil()); + naCallMethodCtx(ctx, holder->get_naRef(), self, n, args, naNil()); const char* error = naGetError(ctx); std::string error_str(error ? error : ""); -- 2.39.5