From 50f2e2618773d73d1273ebce43a332b644bef52b Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 16 Apr 2024 18:58:10 +0100 Subject: [PATCH] fix server showing error on invalid server --- src/app/player/[id]/page.tsx | 2 +- src/app/server/[platform]/[hostname]/page.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/player/[id]/page.tsx b/src/app/player/[id]/page.tsx index 0c3380f..6cf1f54 100644 --- a/src/app/player/[id]/page.tsx +++ b/src/app/player/[id]/page.tsx @@ -14,7 +14,7 @@ type Params = { export async function generateMetadata({ params: { id } }: Params): Promise { const player = await getData(id); - if (!player) { + if (player == null) { return generateEmbed({ title: "Unknown Player", description: "Player not found" }); } diff --git a/src/app/server/[platform]/[hostname]/page.tsx b/src/app/server/[platform]/[hostname]/page.tsx index 034c3f9..f90224a 100644 --- a/src/app/server/[platform]/[hostname]/page.tsx +++ b/src/app/server/[platform]/[hostname]/page.tsx @@ -19,7 +19,7 @@ type Params = { export async function generateMetadata({ params: { platform, hostname } }: Params): Promise { const server = await getData(platform, hostname); - if (!server) { + if (server == null) { return generateEmbed({ title: "Unknown Server", description: "Server not found" }); } @@ -27,8 +27,8 @@ export async function generateMetadata({ params: { platform, hostname } }: Param let favicon = null; // Server favicon + // Java specific if (platform === ServerPlatform.Java) { - // Java specific const javaServer = server as JavaMinecraftServer; favicon = javaServer.favicon && javaServer.favicon.url; } @@ -60,8 +60,8 @@ export default async function Page({ params: { platform, hostname } }: Params) { let favicon = null; // Server favicon - if (platform === ServerPlatform.Java) { - // Java specific + // Java specific + if (server && platform === ServerPlatform.Java) { const javaServer = server as JavaMinecraftServer; favicon = javaServer.favicon && javaServer.favicon.url; }