fix: error handling when there are no results

This commit is contained in:
鲁树人 2023-07-02 15:32:47 +01:00
parent e904aa4397
commit 9db5d94a14

View File

@ -32,7 +32,12 @@ export class DatabaseKeyExtractor {
return null; return null;
} }
const keys = db.exec('select file_path, ekey from `audio_file_ekey_table`')[0].values; const result = db.exec('select file_path, ekey from audio_file_ekey_table');
if (result.length === 0) {
return [];
}
const keys = result[0].values;
return keys.map(([path, ekey]) => ({ return keys.map(([path, ekey]) => ({
// strip dir name // strip dir name
name: getFileName(String(path)), name: getFileName(String(path)),