From d585ea3b25f6ac97949dc896f0aa17db2e4ebe43 Mon Sep 17 00:00:00 2001 From: Nicholas Orlowsky Date: Mon, 12 Dec 2022 09:43:40 -0600 Subject: [PATCH] fixed error handling --- src/nws-api/calls.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nws-api/calls.ts b/src/nws-api/calls.ts index 89eb763..1c545de 100644 --- a/src/nws-api/calls.ts +++ b/src/nws-api/calls.ts @@ -10,7 +10,7 @@ export async function getIncidents(): Promise { let response: Response = await fetch('https://api-nws.nickorlow.com/incidents'); try { let incidents: Incident[] = await response.json(); - if(incidents === null || incidents === undefined) return []; + if(incidents === null || incidents === undefined || !Array.isArray(incidents)) return []; return incidents; } catch (e) { return [];