Skip to content

Commit b3a7171

Browse files
committed
MbedSocketClass: add checks on mac address string
1 parent 3a44c0f commit b3a7171

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libraries/SocketWrapper/src/SocketHelpers.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ uint8_t* arduino::MbedSocketClass::macAddress(uint8_t* mac) {
1111
}
1212

1313
String arduino::MbedSocketClass::macAddress() {
14-
return String(getNetwork()->get_mac_address());
14+
const char* mac_str = getNetwork()->get_mac_address();
15+
if (!mac_str) {
16+
return String("ff:ff:ff:ff:ff:ff");
17+
}
18+
return String(mac_str);
1519
}
1620

1721
int arduino::MbedSocketClass::hostByName(const char* aHostname, IPAddress& aResult) {

0 commit comments

Comments
 (0)