Skip to content

Commit

Permalink
Return a default user record if json is broken
Browse files Browse the repository at this point in the history
It's possible that json_decode returns null. Mostly the json is broken.
AddMissingDefaultValues expects an array. Pass null will fail.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed Oct 9, 2019
1 parent 99358d7 commit c9511c6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/private/Accounts/AccountManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ public function getUser(IUser $user) {
}

$userDataArray = json_decode($result[0]['data'], true);
if ($userDataArray === null || json_last_error() !== JSON_ERROR_NONE) {
return $this->buildDefaultUserRecord($user);
}

$userDataArray = $this->addMissingDefaultValues($userDataArray);

Expand Down

0 comments on commit c9511c6

Please sign in to comment.