fix(events): Fix crash in getStdFunctionAddress (#10321)

This commit is contained in:
Me No Dev 2024-09-13 10:49:28 +03:00 committed by GitHub
parent 4e9eb35752
commit eda6d21d87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -228,7 +228,10 @@ void NetworkEvents::removeEvent(NetworkEventCb cbEvent, arduino_event_id_t event
template<typename T, typename... U> static size_t getStdFunctionAddress(std::function<T(U...)> f) {
typedef T(fnType)(U...);
fnType **fnPointer = f.template target<fnType *>();
return (size_t)*fnPointer;
if (fnPointer != nullptr) {
return (size_t)*fnPointer;
}
return (size_t)fnPointer;
}
void NetworkEvents::removeEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event) {