@@ -336,27 +336,35 @@ idrinth.settings = {
336336 * @returns {undefined }
337337 */
338338 var getCurrent = function ( ) {
339- var data = JSON . parse ( window . localStorage . getItem ( 'idotd' ) ) ;
340- /**
341- *
342- * @param {object } to
343- * @param {object } from
344- * @param {function } apply
345- * @returns {undefined }
346- */
347- var apply = function ( to , from , apply ) {
348- for ( var key in from ) {
349- if ( from . hasOwnProperty ( key ) ) {
350- if ( typeof from [ key ] === 'object' ) {
351- to [ key ] = typeof to [ key ] === 'object' ? to [ key ] : { } ;
352- apply ( to [ key ] , from [ key ] ) ;
353- } else {
354- to [ key ] = from [ key ] ;
339+ try {
340+ var data = JSON . parse ( window . localStorage . getItem ( 'idotd' ) ) ;
341+ /**
342+ *
343+ * @param {object } to
344+ * @param {object } from
345+ * @param {function } apply
346+ * @returns {undefined }
347+ */
348+ var apply = function ( to , from , apply ) {
349+ for ( var key in from ) {
350+ if ( from . hasOwnProperty ( key ) ) {
351+ if ( typeof from [ key ] === 'object' ) {
352+ to [ key ] = typeof to [ key ] === 'object' ? to [ key ] : { } ;
353+ apply ( to [ key ] , from [ key ] ) ;
354+ } else {
355+ to [ key ] = from [ key ] ;
356+ }
355357 }
356358 }
359+ } ;
360+ if ( ! data ) {
361+ return ;
357362 }
358- } ;
359- apply ( idrinth . settings . data , data , apply ) ;
363+ apply ( idrinth . settings . data , data , apply ) ;
364+ } catch ( exception ) {
365+ idrinth . core . alert ( "There was a failure when trying to handle settings, the have been reset to default." ) ;
366+ idrinth . core . log ( exception . getMessage ?exception . getMessage ( ) :exception . message ) ;
367+ }
360368 } ;
361369 /**
362370 * fills the data from seperate storages
0 commit comments