" + @@ -1348,23 +1349,28 @@ OSApp.UIDom.launchApp = function() { currentSite = siteSelect.val(); OSApp.Storage.get( "sites", function( data ) { sites = OSApp.Sites.parseSites( data.sites ); - if ( typeof sites[ currentSite ].images !== "object" || $.isEmptyObject( sites[ currentSite ].images ) ) { + // Prevent errors during test: page navigation checks + if ( !sites || $.isEmptyObject(sites) || !currentSite ) { + return; + } + + if ( typeof sites[ currentSite ]?.images !== "object" || $.isEmptyObject( sites[ currentSite ].images ) ) { sites[ currentSite ].images = {}; page.removeClass( "has-images" ); } else { page.addClass( "has-images" ); } - if ( typeof sites[ currentSite ].notes !== "object" ) { + if ( typeof sites[ currentSite ]?.notes !== "object" ) { sites[ currentSite ].notes = {}; } - if ( typeof sites[ currentSite ].lastRunTime !== "object" ) { + if ( typeof sites[ currentSite ]?.lastRunTime !== "object" ) { sites[ currentSite ].lastRunTime = {}; } callback(); } ); - }, - cards, siteSelect, currentSite, i, sites; + }; + page.one( "pageshow", function() { $( "html" ).on( "datarefresh", updateContent ); diff --git a/www/js/modules/weather.js b/www/js/modules/weather.js index d31517d3..0fde6cab 100644 --- a/www/js/modules/weather.js +++ b/www/js/modules/weather.js @@ -941,7 +941,7 @@ OSApp.Weather.getAdjustmentMethod = function( id ) { // TODO: does getAdjustmentMethod duplicate this logic? if so please refactor one or the other. OSApp.Weather.getCurrentAdjustmentMethodId = function() { - return OSApp.currentSession.controller.options.uwt & ~( 1 << 7 ); + return OSApp.currentSession?.controller?.options?.uwt & ~( 1 << 7 ); }; OSApp.Weather.getRestriction = function( id ) {