Skip to content

Commit

Permalink
Return empty if no folder
Browse files Browse the repository at this point in the history
  • Loading branch information
azlux authored and bokub committed Mar 1, 2024
1 parent fea2787 commit bf9ff8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const userDir = '/addon_configs/cf6b56a3_linky';
export async function getMeterHistory(prm: string): Promise<EnergyDataPoint[]> {
if (!existsSync(baseDir)) {
debug(`Cannot find folder ${userDir}`);
return;
return [];
}
const files = readdirSync(baseDir).filter((file) => file.endsWith('.csv'));
debug(`Found ${files.length} CSV ${files.length > 1 ? 'files' : 'file'} in ${userDir}`);
Expand Down

0 comments on commit bf9ff8e

Please sign in to comment.