check for empty string

This commit is contained in:
2025-11-16 16:35:17 +01:00
parent 66fd6d6780
commit b9e16a52ec

View File

@@ -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<z.output<typeof BootEntries>> {