From 9f6f0ab7b34c9a2b0259d0bb50dde9134909cbf3 Mon Sep 17 00:00:00 2001 From: karolina-siemieniuk-morawska Date: Tue, 23 Jan 2024 13:48:18 +0100 Subject: [PATCH] fix undefined property error * ref: cern-sis/issues-inspire#424 --- src/shared/services/compare-keys-by-schema.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/services/compare-keys-by-schema.service.ts b/src/shared/services/compare-keys-by-schema.service.ts index 70548ebd..21de86e4 100644 --- a/src/shared/services/compare-keys-by-schema.service.ts +++ b/src/shared/services/compare-keys-by-schema.service.ts @@ -34,8 +34,8 @@ export class CompareKeysBySchemaService { */ compare(key1: string, key2: string, schema: JSONSchema): number { // Sort by priority, larger is the first. - const priorty1 = schema.properties[key1].priority || 0; - const priority2 = schema.properties[key2].priority || 0; + const priorty1 = schema?.properties[key1]?.priority || 0; + const priority2 = schema?.properties[key2]?.priority || 0; if (priorty1 > priority2) { return -1; } if (priorty1 < priority2) { return 1; }