Skip to content

Commit 4217815

Browse files
committed
Catch error and return null when no user profile
1 parent 4e95fab commit 4217815

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libraries/User.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use \BNETDocs\Libraries\Credits;
66
use \BNETDocs\Libraries\Exceptions\QueryException;
77
use \BNETDocs\Libraries\Exceptions\UserNotFoundException;
8+
use \BNETDocs\Libraries\Exceptions\UserProfileNotFoundException;
89
use \BNETDocs\Libraries\UserProfile;
910
use \CarlBennett\MVC\Libraries\Common;
1011
use \CarlBennett\MVC\Libraries\Database;
@@ -462,7 +463,11 @@ public function getUsername() {
462463
}
463464

464465
public function getUserProfile() {
465-
return new UserProfile($this->id);
466+
try {
467+
return new UserProfile($this->id);
468+
} catch (UserProfileNotFoundException $e) {
469+
return null;
470+
}
466471
}
467472

468473
public function getVerifiedDateTime() {

0 commit comments

Comments
 (0)