diff --git a/cli/src/connections.c b/cli/src/connections.c index 5099b502d..e0b94ceb8 100644 --- a/cli/src/connections.c +++ b/cli/src/connections.c @@ -717,10 +717,11 @@ check_ethernet_compatible (NMDeviceEthernet *device, NMConnection *connection, G if (s_wired) { const GByteArray *mac; const char *device_mac_str; - struct ether_addr *device_mac; + struct ether_addr *device_mac = NULL; device_mac_str = nm_device_ethernet_get_permanent_hw_address (device); - device_mac = ether_aton (device_mac_str); + if (device_mac_str) + device_mac = ether_aton (device_mac_str); if (!device_mac) { g_set_error (error, 0, 0, "Invalid device MAC address."); return FALSE; @@ -766,10 +767,11 @@ check_wifi_compatible (NMDeviceWifi *device, NMConnection *connection, GError ** if (s_wireless) { const GByteArray *mac; const char *device_mac_str; - struct ether_addr *device_mac; + struct ether_addr *device_mac = NULL; device_mac_str = nm_device_wifi_get_permanent_hw_address (device); - device_mac = ether_aton (device_mac_str); + if (device_mac_str) + device_mac = ether_aton (device_mac_str); if (!device_mac) { g_set_error (error, 0, 0, "Invalid device MAC address."); return FALSE;