From f07f380d8bea285cc76d9a2fa0f0a9bca00bb373 Mon Sep 17 00:00:00 2001 From: Henri Remonen Date: Wed, 20 Sep 2023 10:13:08 +0300 Subject: [PATCH] fix: Fix course selection not crashing if missing language fields from sisu data --- src/client/util/courses.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/client/util/courses.ts b/src/client/util/courses.ts index ad1f2de6..c3f10706 100644 --- a/src/client/util/courses.ts +++ b/src/client/util/courses.ts @@ -16,11 +16,12 @@ export const otherCourse = { } export const getCourseName = (course: Course, language: keyof Locales) => { + console.log(course) const name = - course.name[language as keyof Locales].length > - course.nameSpecifier[language as keyof Locales].length - ? course.name - : course.nameSpecifier + course.name[language as keyof Locales]?.length > + course.nameSpecifier[language as keyof Locales]?.length + ? course?.name + : course?.nameSpecifier return name }