From 6e31544846150ee20922c28fac4590172da514ce Mon Sep 17 00:00:00 2001 From: xavilien <“xavilien@gmail.com”> Date: Fri, 16 Aug 2024 15:58:49 +0800 Subject: [PATCH] Add check that id exists in standardizeId --- frontend/src/app/utils.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/utils.tsx b/frontend/src/app/utils.tsx index 39c5c2d..e7cd3eb 100644 --- a/frontend/src/app/utils.tsx +++ b/frontend/src/app/utils.tsx @@ -8,7 +8,7 @@ import namecase from "namecase"; export const courseIdRegex = /([0-9]{2}-?[0-9]{3})/g; export const standardizeId = (id: string) => { - if (!id.includes("-") && id.length >= 5) { + if (id && !id.includes("-") && id.length >= 5) { return id.slice(0, 2) + "-" + id.slice(2); }