From 642a773d2603b0e1d11e972b7094f5b8c2f42749 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Mon, 15 Apr 2024 13:12:35 +0200 Subject: [PATCH] ERROR TypeError: Cannot read properties of undefined (reading 'vnd.farmmaps.itemtype.croppingscheme') at ItemTypeService.getExtraAttributes --- projects/common/src/fm/services/itemtype.service.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/common/src/fm/services/itemtype.service.ts b/projects/common/src/fm/services/itemtype.service.ts index 4586ac6..f844360 100644 --- a/projects/common/src/fm/services/itemtype.service.ts +++ b/projects/common/src/fm/services/itemtype.service.ts @@ -15,37 +15,37 @@ export class ItemTypeService { getIcon(itemType: string) { let icon = "fal fa-file"; - if (this.itemTypes[itemType]) icon = this.itemTypes[itemType].icon; + if (this.itemTypes && this.itemTypes[itemType]) icon = this.itemTypes[itemType].icon; return icon; } getColor(itemType: string) { let color = "#000000"; - if (this.itemTypes[itemType]) color = this.itemTypes[itemType].iconColor; + if (this.itemTypes && this.itemTypes[itemType]) color = this.itemTypes[itemType].iconColor; return color; } getExtraAttributes(itemType: string) { let extraAttributes = null; - if (this.itemTypes[itemType] && this.itemTypes[itemType].extraAttributes) extraAttributes = this.itemTypes[itemType].extraAttributes; + if (this.itemTypes && this.itemTypes[itemType] && this.itemTypes[itemType].extraAttributes) extraAttributes = this.itemTypes[itemType].extraAttributes; return extraAttributes; } getSchema(itemType: string): string { let schema = null; - if (this.itemTypes[itemType]) schema = this.itemTypes[itemType].schema; + if (this.itemTypes && this.itemTypes[itemType]) schema = this.itemTypes[itemType].schema; return schema; } hasViewer(item: IItem) { const itemType: string = item.itemType; - if (this.itemTypes[itemType]) return this.itemTypes[itemType].viewer !== undefined; + if (this.itemTypes && this.itemTypes[itemType]) return this.itemTypes[itemType].viewer !== undefined; return false; } hasEditor(item: IItem) { const itemType: string = item.itemType; - if (this.itemTypes[itemType]) return this.itemTypes[itemType].editor !== undefined; + if (this.itemTypes && this.itemTypes[itemType]) return this.itemTypes[itemType].editor !== undefined; return false; }