From b1f14215e18f52fc1f6a2413888badfc9ca8bc1c Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 29 Aug 2019 11:58:20 -0400 Subject: [PATCH] LP1832897 FM Editor fieldOptions sanity check If the caller sets the fieldOptions property to null/undefined the FM editor will throw a JS error (field.isRequired is not a function) and fail to render properly. This adds a sanity check to the fieldOptions value. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander Signed-off-by: Jane Sandberg --- Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts index 0cd9a6f3d8..b6e2638bbf 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts @@ -176,6 +176,10 @@ export class FmRecordEditorComponent // Avoid fetching data on init since that may lead to unnecessary // data retrieval. ngOnInit() { + + // In case the caller sets the value to null / undef. + if (!this.fieldOptions) { this.fieldOptions = {}; } + this.listifyInputs(); this.idlDef = this.idl.classes[this.idlClass]; this.recordLabel = this.idlDef.label; -- 2.11.0