cli: don't crash if for some reason HW addresses aren't available (bgo #630534)

This commit is contained in:
Dan Williams
2010-09-27 16:29:56 -05:00
parent 36795744b7
commit f62666dbff

View File

@@ -717,10 +717,11 @@ check_ethernet_compatible (NMDeviceEthernet *device, NMConnection *connection, G
if (s_wired) { if (s_wired) {
const GByteArray *mac; const GByteArray *mac;
const char *device_mac_str; 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_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) { if (!device_mac) {
g_set_error (error, 0, 0, "Invalid device MAC address."); g_set_error (error, 0, 0, "Invalid device MAC address.");
return FALSE; return FALSE;
@@ -766,10 +767,11 @@ check_wifi_compatible (NMDeviceWifi *device, NMConnection *connection, GError **
if (s_wireless) { if (s_wireless) {
const GByteArray *mac; const GByteArray *mac;
const char *device_mac_str; 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_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) { if (!device_mac) {
g_set_error (error, 0, 0, "Invalid device MAC address."); g_set_error (error, 0, 0, "Invalid device MAC address.");
return FALSE; return FALSE;