Permalink
Browse files

web storage adapter checks for null. AEROGEAR-1076

  • Loading branch information...
1 parent dc8f7ab commit 9a02683ddf3545ae5c7b13ac3a3f6ac843391d83 @lholmquist committed Apr 4, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/data-manager/adapters/session-local.js
@@ -48,7 +48,8 @@ AeroGear.DataManager.adapters.SessionLocal = function( storeName, settings ) {
name = storeName,
appContext = document.location.pathname.replace(/[\/\.]/g,"-"),
storeKey = name + appContext,
- currentData = JSON.parse( window[ storeType ].getItem( storeKey ) );
+ content = window[ storeType ].getItem( storeKey ),
+ currentData = content ? JSON.parse( content ) : null ;
// Initialize data from the persistent store if it exists
if ( currentData ) {

2 comments on commit 9a02683

@sebastienblanc

+0.99 ;) Fix seems okay but not able to test because don't have a device with android 2.3.5

@kborchers

Seems sane. Most parsers will parse null as null which is valid but if old Android doesn't, then this should be fine for all. I haven't tested 2.3.5 but if all tests still pass, this should be fine.

👍

Please sign in to comment.