Skip to content

Commit

Permalink
Update Player.php
Browse files Browse the repository at this point in the history
When a player's account is private and you call GetPlayerLevelDetails() the Containers\Player\Level class cannot be created because $details = $this->GetBadges(); will return empty and the Containers\Player\Level class constructor will fail.

Why do I return NULL so I can just check if GetPlayerLevelDetails () returns NULL is meant there account is probably private.
  • Loading branch information
Sindious authored Oct 7, 2020
1 parent 1ab2478 commit 5bae25a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Syntax/SteamApi/Steam/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public function GetSteamLevel()
public function GetPlayerLevelDetails()
{
$details = $this->GetBadges();

if(count((array)$details) == 0){
return NULL;
}

$details = new Level($details);

Expand Down

0 comments on commit 5bae25a

Please sign in to comment.