From 8d547d84b10eb287938006d40d0ffcbcc6d122ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 14 Sep 2023 12:32:35 +0200 Subject: [PATCH] fix: Do not log console errors if buttons is an empty array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/filepicker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/filepicker.ts b/lib/filepicker.ts index b16167f5..d3284e43 100644 --- a/lib/filepicker.ts +++ b/lib/filepicker.ts @@ -143,7 +143,7 @@ export class FilePickerBuilder { } public build(): FilePicker { - if (this.buttons && this.type !== FilePickerType.Custom) { + if (this.buttons?.length > 0 && this.type !== FilePickerType.Custom) { console.error('FilePickerBuilder: When adding custom buttons the `type` must be set to `FilePickerType.Custom`.') }