From 36f668428ac569332922436295f8b469ba01c379 Mon Sep 17 00:00:00 2001 From: tristantbg Date: Mon, 25 Sep 2017 19:02:03 +0200 Subject: [PATCH] Prevent errors when no page / no state in cache The first page loaded for example --- src/jquery.smoothState.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jquery.smoothState.js b/src/jquery.smoothState.js index b14ba7e..1ceacf4 100644 --- a/src/jquery.smoothState.js +++ b/src/jquery.smoothState.js @@ -331,7 +331,7 @@ $page = $('#' + e.state.id), page = $page.data('smoothState'), diffUrl = (page.href !== url && !utility.isHash(url, page.href)), - diffState = (e.state !== page.cache[page.href].state); + diffState = (page.cache[page.href] && e.state !== page.cache[page.href].state); if(diffUrl || diffState) { if (diffState) { @@ -835,4 +835,4 @@ /* expose the default options */ $.fn.smoothState.options = defaults; -})); \ No newline at end of file +}));