Skip to content

Commit eda6d21

Browse files
authored
fix(events): Fix crash in getStdFunctionAddress (#10321)
1 parent 4e9eb35 commit eda6d21

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libraries/Network/src/NetworkEvents.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,10 @@ void NetworkEvents::removeEvent(NetworkEventCb cbEvent, arduino_event_id_t event
228228
template<typename T, typename... U> static size_t getStdFunctionAddress(std::function<T(U...)> f) {
229229
typedef T(fnType)(U...);
230230
fnType **fnPointer = f.template target<fnType *>();
231-
return (size_t)*fnPointer;
231+
if (fnPointer != nullptr) {
232+
return (size_t)*fnPointer;
233+
}
234+
return (size_t)fnPointer;
232235
}
233236

234237
void NetworkEvents::removeEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event) {

0 commit comments

Comments
 (0)