Skip to content

Commit

Permalink
Only if a record exists
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed Nov 8, 2024
1 parent 557459c commit e22e28c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ private function handleUserElementChanges(): void
$user = $event->sender;
$userRecord = UserRecord::findOne($user->id);
$settings = $this->getSettings();
if ($user->isCredentialed && $settings['syncChangedUserEmailsToStripe']) {
if ($userRecord && $user->isCredentialed && $settings['syncChangedUserEmailsToStripe']) {
$oldEmail = $userRecord->getAttribute('email');
$newEmail = $user->email;
if ($oldEmail != $newEmail) {
Expand Down

0 comments on commit e22e28c

Please sign in to comment.