Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 46be999

Browse files
committedSep 10, 2024·
fix(events): Fix crash in getStdFunctionAddress
1 parent cbe0f2f commit 46be999

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)
Please sign in to comment.