From f62666dbff3dea6b1008b1fcd6ed66e7f981566e Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 27 Sep 2010 16:29:56 -0500 Subject: [PATCH] cli: don't crash if for some reason HW addresses aren't available (bgo #630534) --- cli/src/connections.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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;