@@ -70,20 +70,23 @@ nsapi_error_t EMACInterface::connect()
70
70
71
71
nsapi_error_t EMACInterface::disconnect ()
72
72
{
73
- return _interface->bringdown ();
73
+ if (_interface) {
74
+ return _interface->bringdown ();
75
+ }
76
+ return NSAPI_ERROR_NO_CONNECTION;
74
77
}
75
78
76
79
const char *EMACInterface::get_mac_address ()
77
80
{
78
- if (_interface->get_mac_address (_mac_address, sizeof (_mac_address))) {
81
+ if (_interface && _interface ->get_mac_address (_mac_address, sizeof (_mac_address))) {
79
82
return _mac_address;
80
83
}
81
84
return NULL ;
82
85
}
83
86
84
87
const char *EMACInterface::get_ip_address ()
85
88
{
86
- if (_interface->get_ip_address (_ip_address, sizeof (_ip_address))) {
89
+ if (_interface && _interface ->get_ip_address (_ip_address, sizeof (_ip_address))) {
87
90
return _ip_address;
88
91
}
89
92
@@ -92,7 +95,7 @@ const char *EMACInterface::get_ip_address()
92
95
93
96
const char *EMACInterface::get_netmask ()
94
97
{
95
- if (_interface->get_netmask (_netmask, sizeof (_netmask))) {
98
+ if (_interface && _interface ->get_netmask (_netmask, sizeof (_netmask))) {
96
99
return _netmask;
97
100
}
98
101
@@ -101,7 +104,7 @@ const char *EMACInterface::get_netmask()
101
104
102
105
const char *EMACInterface::get_gateway ()
103
106
{
104
- if (_interface->get_gateway (_gateway, sizeof (_gateway))) {
107
+ if (_interface && _interface ->get_gateway (_gateway, sizeof (_gateway))) {
105
108
return _gateway;
106
109
}
107
110
0 commit comments