wwan: fix wrong assert in deactivate_cleanup()

When the modem device is abruptly disconnected,
nm_modem_device_state_changed() calls deactivate_cleanup() with a NULL
device argument and that's perfectly fine.

We should only check the instance type if we know the device is non-NULL.

(NetworkManager:9166): NetworkManager-wwan-CRITICAL **: deactivate_cleanup: assertion 'NM_IS_DEVICE ( failed

(cherry picked from commit 41c87eb363)
This commit is contained in:
Lubomir Rintel 2015-01-30 10:45:27 +01:00 committed by Dan Williams
parent 6f2e6071bc
commit 762f55ce93

View file

@ -847,7 +847,6 @@ deactivate_cleanup (NMModem *self, NMDevice *device)
int ifindex;
g_return_if_fail (NM_IS_MODEM (self));
g_return_if_fail (NM_IS_DEVICE (device));
priv = NM_MODEM_GET_PRIVATE (self);
@ -867,6 +866,8 @@ deactivate_cleanup (NMModem *self, NMDevice *device)
}
if (device) {
g_return_if_fail (NM_IS_DEVICE (device));
if (priv->ip4_method == NM_MODEM_IP_METHOD_STATIC ||
priv->ip4_method == NM_MODEM_IP_METHOD_AUTO ||
priv->ip6_method == NM_MODEM_IP_METHOD_STATIC ||