check if oldbg is not null

This commit is contained in:
Maroxy 2021-10-18 10:10:41 +02:00
parent 364eddbb2d
commit 2bef5e2245

View file

@ -120,7 +120,7 @@ export class Genshinlib
else
{
this.downloadFile(resdone.data.adv.background, path.join(this.launcherDir, this.getConfig().background.name), (current: number, total: number, difference: number) => null).then(() => {
fs.unlinkSync(path.join(this.launcherDir, oldbg));
oldbg ? fs.unlinkSync(path.join(this.launcherDir, oldbg)) : '';
bg = path.join(this.launcherDir, this.getConfig().background.name);
})
};