device: don't create devices with 0 ports

If for any reason we're requested to create a device with 0 ports, just return
error.
This commit is contained in:
Aleksander Morgado
2012-07-22 13:07:26 +02:00
parent da0226708a
commit b8cc7c66ec

View File

@@ -372,7 +372,14 @@ mm_device_create_modem (MMDevice *self,
{
g_assert (self->priv->modem == NULL);
g_assert (self->priv->object_manager == NULL);
g_assert (self->priv->port_probes != NULL);
if (!self->priv->port_probes) {
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Not creating a device without ports");
return FALSE;
}
mm_info ("Creating modem with plugin '%s' and '%u' ports",
mm_plugin_get_name (self->priv->plugin),