Guard against JSON.parse(null) to workaround issue on Android 2.3

At least on Android 2.3.x webviews, trying to `JSON.parse(null)` results in an error.

This pull request avoid the parsing when the value read from localStorage is null.

Includes tests to assert that:
- JSON.parse(null) is avoided
- we still return `null` like the curent implementation when running on modern browsers