summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-10 09:07:58 +0100
committerThomas Haller <thaller@redhat.com>2017-11-10 09:07:58 +0100
commitc2e1b69920bb850f5556cd8623f4fc7e49fa39be (patch)
tree1784cee8ec47d7231103b2a602e603468d48574c
parentcbb997081db778c49385067a0558cb0392e0cefd (diff)
downloadNetworkManager-c2e1b69920bb850f5556cd8623f4fc7e49fa39be.tar.gz
ofono: refactor error handling for missing Interface in context_property_changed()
-rw-r--r--src/devices/wwan/nm-modem-ofono.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/devices/wwan/nm-modem-ofono.c b/src/devices/wwan/nm-modem-ofono.c
index 7e9a4c97cd..3a1e9d6898 100644
--- a/src/devices/wwan/nm-modem-ofono.c
+++ b/src/devices/wwan/nm-modem-ofono.c
@@ -830,6 +830,7 @@ context_property_changed (GDBusProxy *proxy,
NMPlatformIP4Address addr;
gboolean ret = FALSE;
gs_unref_variant GVariant *v_dict = NULL;
+ const char *interface;
const gchar *s, *addr_s;
const gchar **array, **iter;
guint32 address_network, gateway_network;
@@ -855,21 +856,20 @@ context_property_changed (GDBusProxy *proxy,
_LOGI ("IPv4 static Settings:");
- if (g_variant_lookup (v_dict, "Interface", "&s", &s)) {
- if (s && strlen (s)) {
- _LOGD ("Interface: %s", s);
- g_object_set (self,
- NM_MODEM_DATA_PORT, s,
- NM_MODEM_IP4_METHOD, NM_MODEM_IP_METHOD_STATIC,
- NULL);
- } else {
- _LOGW ("Settings 'Interface'; empty");
- goto out;
- }
- } else {
+ if (!g_variant_lookup (v_dict, "Interface", "&s", &interface)) {
_LOGW ("Settings 'Interface' missing");
goto out;
}
+ if (!interface || !interface[0]) {
+ _LOGW ("Settings 'Interface'; empty");
+ goto out;
+ }
+
+ _LOGD ("Interface: %s", interface);
+ g_object_set (self,
+ NM_MODEM_DATA_PORT, interface,
+ NM_MODEM_IP4_METHOD, NM_MODEM_IP_METHOD_STATIC,
+ NULL);
/* TODO: verify handling of ip4_config; check other places it's used... */
g_clear_object (&priv->ip4_config);