Skip to content

Commit ae10fa4

Browse files
committed
Check if the $event variable is an object before checking if it was dispatched by NativePHP.
1 parent c207793 commit ae10fa4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Events/EventWatcher.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ public function __construct(protected Client $client) {}
1212
public function register(): void
1313
{
1414
Event::listen('*', function (string $eventName, array $data) {
15-
$event = (object)($data[0] ?? null);
15+
$event = $data[0] ?? (object) null;
16+
17+
if(! is_object($event)) {
18+
return;
19+
}
1620

1721
if (! method_exists($event, 'broadcastOn')) {
1822
return;

0 commit comments

Comments
 (0)