diff --git a/endpoints/arena-team/arena-team.php b/endpoints/arena-team/arena-team.php index 509fbdf3..04587f70 100644 --- a/endpoints/arena-team/arena-team.php +++ b/endpoints/arena-team/arena-team.php @@ -58,7 +58,7 @@ class ArenateamBaseResponse extends TemplateResponse // 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it) $subjects = DB::Characters($this->realmId)->select('SELECT at.`arenaTeamId` AS "realmGUID", at.`name`, at.`type` FROM arena_team at WHERE at.`name` = ?', $this->subjectName); - if ($subject = array_filter($subjects, fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName))) + if ($subject = array_filter($subjects ?: [], fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName))) { $subject = array_pop($subject); $subject['realm'] = $this->realmId; diff --git a/endpoints/guild/guild.php b/endpoints/guild/guild.php index 10a4e63c..7c74b2aa 100644 --- a/endpoints/guild/guild.php +++ b/endpoints/guild/guild.php @@ -58,7 +58,7 @@ class GuildBaseResponse extends TemplateResponse // 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it) $subjects = DB::Characters($this->realmId)->select('SELECT `guildid` AS "realmGUID", `name` FROM guild WHERE `name` = ?', $this->subjectName); - if ($subject = array_filter($subjects, fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName))) + if ($subject = array_filter($subjects ?: [], fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName))) { $subject = array_pop($subject); $subject['realm'] = $this->realmId; diff --git a/endpoints/profile/profile.php b/endpoints/profile/profile.php index e3db2365..3636624f 100644 --- a/endpoints/profile/profile.php +++ b/endpoints/profile/profile.php @@ -90,7 +90,7 @@ class ProfileBaseResponse extends TemplateResponse WHERE c.`name` = ? AND `level` <= ?d AND (`extra_flags` & ?d) = 0', Util::ucFirst($this->subjectName), MAX_LEVEL, Profiler::CHAR_GMFLAGS ); - if ($subject = array_filter($subjects, fn($x) => Util::lower($x['name']) == Util::lower($this->subjectName))) + if ($subject = array_filter($subjects ?: [], fn($x) => Util::lower($x['name']) == Util::lower($this->subjectName))) { $subject = $subject[0]; $subject['realm'] = $this->realmId;