check for empty string
This commit is contained in:
@@ -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>> {
|
||||
|
||||
Reference in New Issue
Block a user