This was not permitted by the API before, but would in some
circumstances work.
---
generator/generator | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/generator/generator b/generator/generator
index 7f97163..01da1c3 100755
--- a/generator/generator
+++ b/generator/generator
@@ -3664,6 +3664,16 @@ let generate_lib_api_c () =
in
List.iter (
function
+ | Closure { cbname } ->
+ let value = match errcode with
+ | Some value -> value
+ | None -> assert false in
+ pr " if (%s_callback == NULL) {\n" cbname;
+ pr " set_error (EFAULT, \"%%s cannot be NULL\",
\"%s\");\n" cbname;
+ pr " ret = %s;\n" value;
+ pr " goto out;\n";
+ pr " }\n";
+ need_out_label := true
| Enum (n, { enum_prefix; enums }) ->
let value = match errcode with
| Some value -> value
--
2.22.0