From b9e16a52ec51ecf0e344cb1e069a31c2793a70f7 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Sun, 16 Nov 2025 16:35:17 +0100 Subject: [PATCH] check for empty string --- src/efibootmgr.service.ts | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/efibootmgr.service.ts b/src/efibootmgr.service.ts index 32025f0..ebc5ba4 100644 --- a/src/efibootmgr.service.ts +++ b/src/efibootmgr.service.ts @@ -58,26 +58,28 @@ export class EfiBootMgrService { }; } - return outputValues.entries.map((v) => { - logger.debug(`Processing boot entry: ${v}`); + return outputValues.entries + .filter((e) => ![e].join("")) + .map((v) => { + logger.debug(`Processing boot entry: ${v}`); - const [bootStr, labelStr] = v.split("* "); + const [bootStr, labelStr] = v.split("* "); - if (!bootStr || !labelStr) throw new Error("Invalid output!"); + if (!bootStr || !labelStr) throw new Error("Invalid output!"); - const digits = bootStr.match(/\d/g); + const digits = bootStr.match(/\d/g); - if (digits === null) throw new Error("invalid output!"); + if (digits === null) throw new Error("invalid output!"); - const [osName] = labelStr.split("\t"); + const [osName] = labelStr.split("\t"); - if (!osName) throw new Error("Invalid output!"); + if (!osName) throw new Error("Invalid output!"); - return { - label: osName, - number: Number.parseInt(digits.join(""), 10), - }; - }); + return { + label: osName, + number: Number.parseInt(digits.join(""), 10), + }; + }); } async listBootEntries(): Promise> {