Skip to content

Commit

Permalink
Catch error and return null when no user profile
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbennett committed Jul 7, 2021
1 parent 4e95fab commit 4217815
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libraries/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use \BNETDocs\Libraries\Credits;
use \BNETDocs\Libraries\Exceptions\QueryException;
use \BNETDocs\Libraries\Exceptions\UserNotFoundException;
use \BNETDocs\Libraries\Exceptions\UserProfileNotFoundException;
use \BNETDocs\Libraries\UserProfile;
use \CarlBennett\MVC\Libraries\Common;
use \CarlBennett\MVC\Libraries\Database;
Expand Down Expand Up @@ -462,7 +463,11 @@ public function getUsername() {
}

public function getUserProfile() {
return new UserProfile($this->id);
try {
return new UserProfile($this->id);
} catch (UserProfileNotFoundException $e) {
return null;
}
}

public function getVerifiedDateTime() {
Expand Down

0 comments on commit 4217815

Please sign in to comment.