From 1fe5147f1f37033c280ab828a5601de0f4b382f8 Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Tue, 29 Mar 2022 18:01:10 +0200 Subject: [PATCH] [editor] Prevent sanatization message on empty unit --- projects/editor/src/app/services/unit.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/editor/src/app/services/unit.service.ts b/projects/editor/src/app/services/unit.service.ts index 75befb2a4..ac51972d2 100644 --- a/projects/editor/src/app/services/unit.service.ts +++ b/projects/editor/src/app/services/unit.service.ts @@ -48,7 +48,9 @@ export class UnitService { loadUnitDefinition(unitDefinition: string): void { this.idService.reset(); const sanatizationResult = UnitDefinitionSanitizer.sanitizeUnitDefinition(JSON.parse(unitDefinition)); - if (sanatizationResult[1]) this.messageService.showWarning('Loaded outdated unit definition.'); + if (unitDefinition) { + if (sanatizationResult[1]) this.messageService.showWarning('Loaded outdated unit definition.'); + } this.unit = UnitFactory.createUnit(sanatizationResult[0]); UnitService.readIDs(this.unit); } -- GitLab