handle the undefined behaviour

This commit is contained in:
Mylloon 2023-07-30 02:36:16 +02:00
parent 45235e63ce
commit 1853388ee6
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -4,7 +4,7 @@ let internals: {
allowedExtensions: () => Promise<{ allowedExtensions: () => Promise<{
extensions: string[]; extensions: string[];
}>; }>;
askFile: () => Promise<string[]>; askFile: () => Promise<string[] | undefined>;
exit: () => Promise<void>; exit: () => Promise<void>;
mergeAudio: (filename: string) => Promise<string>; mergeAudio: (filename: string) => Promise<string>;
confirmation: (text: string) => Promise<void>; confirmation: (text: string) => Promise<void>;
@ -22,7 +22,7 @@ const getFile = async () => {
} }
const file = await internals.askFile(); const file = await internals.askFile();
if (file.length === 0) { if (file === undefined || file.length === 0) {
await internals.exit(); await internals.exit();
} }
return file.join(""); return file.join("");