platform: fix NULL pointer dereference

src/libnm-platform/nmp-object.c:930: var_deref_op: Dereferencing null pointer "klass->cmd_plobj_to_string_id".

Fixes: 8feeb199ad ('platform: drop redundant hook implementations from NMPObject classes')
This commit is contained in:
Beniamino Galvani 2022-12-22 11:33:24 +01:00
parent a39ec8ca75
commit 2883203df4

View file

@ -926,7 +926,7 @@ nmp_object_to_string(const NMPObject *obj,
switch (to_string_mode) {
case NMP_OBJECT_TO_STRING_ID:
if (!klass->cmd_plobj_to_string_id)
if (klass->cmd_plobj_to_string_id)
return klass->cmd_plobj_to_string_id(&obj->object, buf, buf_size);
g_snprintf(buf, buf_size, NM_HASH_OBFUSCATE_PTR_FMT, NM_HASH_OBFUSCATE_PTR(obj));
return buf;