From eda6d21d872831b052bf02fb57774b1252cf4930 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Fri, 13 Sep 2024 10:49:28 +0300 Subject: [PATCH] fix(events): Fix crash in getStdFunctionAddress (#10321) --- libraries/Network/src/NetworkEvents.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/Network/src/NetworkEvents.cpp b/libraries/Network/src/NetworkEvents.cpp index 9ebf00b476a..3643734b413 100644 --- a/libraries/Network/src/NetworkEvents.cpp +++ b/libraries/Network/src/NetworkEvents.cpp @@ -228,7 +228,10 @@ void NetworkEvents::removeEvent(NetworkEventCb cbEvent, arduino_event_id_t event template static size_t getStdFunctionAddress(std::function f) { typedef T(fnType)(U...); fnType **fnPointer = f.template target(); - 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) {