Skip to content

Commit

Permalink
check if the function exists before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Nov 28, 2024
1 parent b7f4651 commit bcc7a37
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/components/routes/Stats/Player/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ export function ComponentHandling(
): React.ReactElement {
if (props.isError) {
if (
typeof props.errors == "object" &&
props.errors.includes("Player not found")
typeof props?.errors == "object" &&
typeof props?.errors?.includes === 'function' &&
props?.errors?.includes("Player not found")
) {
return t("notApplicable");
}
Expand Down Expand Up @@ -163,9 +164,8 @@ function Stats(): React.ReactElement {
}
}, [game, history]);
const { t } = useTranslation();
document.title = `${t("siteFullName")} ${t("pageTitle.stats")} | ${
playerGames?.userName || t("loading")
} | ${game || t("notApplicable")}`;
document.title = `${t("siteFullName")} ${t("pageTitle.stats")} | ${playerGames?.userName || t("loading")
} | ${game || t("notApplicable")}`;

return (
<div className="container">
Expand Down Expand Up @@ -280,10 +280,10 @@ interface GameStatsItems {
type: string;
platform: string;
children:
| boolean
| React.ReactChild
| React.ReactFragment
| React.ReactPortal;
| boolean
| React.ReactChild
| React.ReactFragment
| React.ReactPortal;
}

function GameStats(props: Readonly<GameStatsItems>): React.ReactElement {
Expand Down

0 comments on commit bcc7a37

Please sign in to comment.