summaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/src/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctrl/libhicnctrl/src/object.c')
-rw-r--r--ctrl/libhicnctrl/src/object.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ctrl/libhicnctrl/src/object.c b/ctrl/libhicnctrl/src/object.c
index 34f21509a..d9863308e 100644
--- a/ctrl/libhicnctrl/src/object.c
+++ b/ctrl/libhicnctrl/src/object.c
@@ -44,6 +44,12 @@ int hc_object_cmp(hc_object_type_t object_type, hc_object_t *object1,
int hc_object_snprintf(char *s, size_t size, hc_object_type_t object_type,
hc_object_t *object) {
+ if (!object) {
+ if (size == 0) return -1;
+ *s = '\0';
+ return 1;
+ }
+
const hc_object_ops_t *vft = object_vft[object_type];
if (!vft) return -1;
return vft->obj_snprintf(s, size, object);