Skip to content

Commit

Permalink
LocalStorage returns undefined for any key not present (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts authored and thebigredgeek committed Mar 14, 2017
1 parent ce4d93e commit 0fb8ea4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,17 @@ function save(namespaces) {
*/

function load() {
var r;
try {
return exports.storage.debug;
r = exports.storage.debug;
} catch(e) {}

// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (typeof process !== 'undefined' && 'env' in process) {
return process.env.DEBUG;
if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}

return r;
}

/**
Expand Down

0 comments on commit 0fb8ea4

Please sign in to comment.