window.localstorage null fix

When localstorage is disabled inside a browser, it is null which wasn't accounted for.