diff --git a/src/Plugin.php b/src/Plugin.php index 3eb79c7..6b33362 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -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) {