Improve command check with method existence validation

This commit is contained in:
netkas 2024-11-29 22:06:07 -05:00
parent 47f47f2110
commit 69916fed3e
2 changed files with 3 additions and 1 deletions

View file

@ -10,6 +10,7 @@ This update introduces bug fixes and improvements
### Fixed ### Fixed
* Reposition debug log for event handler execution. * Reposition debug log for event handler execution.
* Improve command check with method existence validation
## [8.0.0] - 2024-11-29 ## [8.0.0] - 2024-11-29

View file

@ -365,10 +365,11 @@
/** @var UpdateEvent $eventHandler */ /** @var UpdateEvent $eventHandler */
foreach($this->eventHandlers as $eventHandler) foreach($this->eventHandlers as $eventHandler)
{ {
if(strtolower($eventHandler::getCommand()) === strtolower($command)) if(method_exists($eventHandler, 'getCommand') && strtolower($eventHandler::getCommand()) === strtolower($command))
{ {
$results[] = $eventHandler; $results[] = $eventHandler;
} }
} }
return $results; return $results;