Skip to content

Commit

Permalink
main: Bugfix - add extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
christian committed Apr 22, 2023
1 parent 088dabb commit 0c33cb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Listeners/PosthogListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function handle($event): void
$modelAttributes = $modelAttributes->diff($hidden);
}

if ($modelAttributes->count() > 0) {
$eventParameters[$parameterName] = $event->$parameterName->only($modelAttributes->toArray()) ?? [];
if ($modelAttributes->count() > 0 && $event->$parameterName) {
$eventParameters[$parameterName] = $event->$parameterName?->only($modelAttributes->toArray()) ?? [];
}
}
}
Expand Down

0 comments on commit 0c33cb8

Please sign in to comment.