aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-modem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mm-base-modem.c')
-rw-r--r--src/mm-base-modem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c
index 7e74328a..6fee9ae0 100644
--- a/src/mm-base-modem.c
+++ b/src/mm-base-modem.c
@@ -998,7 +998,8 @@ mm_base_modem_organize_ports (MMBaseModem *self,
if (MM_IS_AT_SERIAL_PORT (data_primary))
mm_at_serial_port_set_flags (MM_AT_SERIAL_PORT (data_primary), MM_AT_PORT_FLAG_NONE);
- mm_at_serial_port_set_flags (primary, MM_AT_PORT_FLAG_PRIMARY);
+ if (primary)
+ mm_at_serial_port_set_flags (primary, MM_AT_PORT_FLAG_PRIMARY);
if (secondary)
mm_at_serial_port_set_flags (secondary, MM_AT_PORT_FLAG_SECONDARY);
@@ -1022,7 +1023,7 @@ mm_base_modem_organize_ports (MMBaseModem *self,
#endif
/* We keep new refs to the objects here */
- self->priv->primary = g_object_ref (primary);
+ self->priv->primary = (primary ? g_object_ref (primary) : NULL);
self->priv->secondary = (secondary ? g_object_ref (secondary) : NULL);
self->priv->qcdm = (qcdm ? g_object_ref (qcdm) : NULL);
self->priv->gps_control = (gps_control ? g_object_ref (gps_control) : NULL);