aboutsummaryrefslogtreecommitdiffstats
path: root/include/afb/c++/binding-wrap.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/afb/c++/binding-wrap.hpp')
-rw-r--r--include/afb/c++/binding-wrap.hpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/afb/c++/binding-wrap.hpp b/include/afb/c++/binding-wrap.hpp
index 04f4add1..ae0e5eeb 100644
--- a/include/afb/c++/binding-wrap.hpp
+++ b/include/afb/c++/binding-wrap.hpp
@@ -90,6 +90,7 @@ bool callsync(const char *api, const char *verb, struct json_object *args, struc
/* apis */
class api
{
+protected:
afb_api_t api_;
public:
using call_cb = void (*)(void *closure, struct json_object *object, const char *error, const char *info, afb_api_t api);
@@ -406,7 +407,7 @@ inline bool event::is_valid() const { return afb_event_is_valid(event_); }
inline int event::broadcast(json_object *object) const { return afb_event_broadcast(event_, object); }
inline int event::push(json_object *object) const { return afb_event_push(event_, object); }
-inline void event::unref() { afb_event_unref(event_); event_ = nullptr; }
+inline void event::unref() { if (event_) { afb_event_unref(event_); } event_ = nullptr; }
inline void event::addref() { afb_event_addref(event_); }
inline const char *event::name() const { return afb_event_name(event_); }