diff --git a/native/cocos/base/CCEventDispatcher.cpp b/native/cocos/base/CCEventDispatcher.cpp index a7b19c6abe..5757843afe 100644 --- a/native/cocos/base/CCEventDispatcher.cpp +++ b/native/cocos/base/CCEventDispatcher.cpp @@ -1291,7 +1291,7 @@ void EventDispatcher::sortEventListenersOfFixedPriority(const EventListener::Lis } -EventDispatcher::EventListenerVector* EventDispatcher::getListeners(const EventListener::ListenerID& listenerID) +EventDispatcher::EventListenerVector* EventDispatcher::getListeners(const EventListener::ListenerID& listenerID) const { auto iter = _listenerMap.find(listenerID); if (iter != _listenerMap.end()) diff --git a/native/cocos/base/CCEventDispatcher.h b/native/cocos/base/CCEventDispatcher.h index 4bc8f6c87f..0925c54abd 100644 --- a/native/cocos/base/CCEventDispatcher.h +++ b/native/cocos/base/CCEventDispatcher.h @@ -249,7 +249,7 @@ protected: void forceAddEventListener(EventListener* listener); /** Gets event the listener list for the event listener type. */ - EventListenerVector* getListeners(const EventListener::ListenerID& listenerID); + EventListenerVector* getListeners(const EventListener::ListenerID& listenerID) const; /** Update dirty flag */ void updateDirtyFlagForSceneGraph();