log-object: don't construct log ID with NULL self_id

If the object has an owner ID already but doesn't yet have enough
information to build its log ID, don't cache a less-than-useful
log ID string for it.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
This commit is contained in:
Dan Williams
2025-05-23 18:46:32 -05:00
parent 42ead88266
commit b24615d801
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ mm_log_object_get_id (MMLogObject *self)
gchar *self_id;
self_id = MM_LOG_OBJECT_GET_IFACE (self)->build_id (self);
if (priv->owner_id) {
if (self_id && priv->owner_id) {
priv->id = g_strdup_printf ("%s/%s", priv->owner_id, self_id);
g_free (self_id);
} else
+3
View File
@@ -132,6 +132,9 @@ log_object_build_id (MMLogObject *_self)
MMPort *self;
self = MM_PORT (_self);
if (!self->priv->device || !self->priv->ptype)
return NULL;
return g_strdup_printf ("%s/%s",
mm_port_get_device (self),
mm_port_type_get_string (mm_port_get_port_type (self)));