Skip to content

Commit cfe006b

Browse files
committed
Don't parse non-excisting data
1 parent b6b257d commit cfe006b

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

static/shared/js/documentation.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,13 @@ $(function() {
114114

115115
// Load the JSON containing all pages
116116
// Has it been loaded before (and stored with localstorage)?
117-
searchIndex = JSON.parse(localStorage['searchIndex']);
118-
if (!searchIndex) {
119-
loadSearchIndex();
120-
} else if (localStorageHasExpired()) {
121-
loadSearchIndex();
117+
if (localStorage['searchIndex']) {
118+
searchIndex = JSON.parse(localStorage['searchIndex']);
119+
120+
if (localStorageHasExpired())
121+
loadSearchIndex();
122+
} else {
123+
loadSearchIndex();
122124
}
123125

124126
function loadSearchIndex() {

0 commit comments

Comments
 (0)