diff --git a/src/nws-api/calls.ts b/src/nws-api/calls.ts index 93164a8..89eb763 100644 --- a/src/nws-api/calls.ts +++ b/src/nws-api/calls.ts @@ -8,7 +8,12 @@ export async function getUptime(): Promise { export async function getIncidents(): Promise { let response: Response = await fetch('https://api-nws.nickorlow.com/incidents'); - let incidents: Incident[] = await response.json(); - return incidents; + try { + let incidents: Incident[] = await response.json(); + if(incidents === null || incidents === undefined) return []; + return incidents; + } catch (e) { + return []; + } }