Skip to content

Commit

Permalink
fix undefined property error
Browse files Browse the repository at this point in the history
  • Loading branch information
karolina-siemieniuk-morawska committed Jan 23, 2024
1 parent 31ef771 commit 9f6f0ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shared/services/compare-keys-by-schema.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit 9f6f0ab

Please sign in to comment.