Skip to content

Commit

Permalink
Fix error when the cache location is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
md-y committed Sep 16, 2021
1 parent fe05ab2 commit 880283f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class Cache {
*/
write(obj) {
let str = this.parse(obj);
if (str !== null) fs.writeFileSync(this.location, str); // Will throw error if the file cannot be written
if (str !== null && this.location !== undefined) fs.writeFileSync(this.location, str); // Will throw error if the file cannot be written
}
}

Expand All @@ -194,7 +194,7 @@ class BrowserCache extends Cache {
*/
write(obj) {
let str = this.parse(obj);
if (str !== null) window.localStorage.setItem(this.location, str);
if (str !== null && this.location !== undefined) window.localStorage.setItem(this.location, str);
}
}

Expand Down

0 comments on commit 880283f

Please sign in to comment.