error handling with local Storage
This commit is contained in:
parent
a9cad34e71
commit
fbbd126cd6
12
index.html
12
index.html
|
@ -119,12 +119,20 @@
|
|||
|
||||
<script src="js/functions.js"></script>
|
||||
<script>
|
||||
closedTopics = JSON.parse(localStorage.getItem("closedTopics"))
|
||||
try {
|
||||
closedTopics = JSON.parse(localStorage.getItem("closedTopics"))
|
||||
} catch (e) {
|
||||
closedTopics = []
|
||||
}
|
||||
if(!closedTopics) {
|
||||
closedTopics = []
|
||||
}
|
||||
|
||||
actualTopic = JSON.parse(localStorage.getItem("actualTopic"))
|
||||
try{
|
||||
actualTopic = JSON.parse(localStorage.getItem("actualTopic"))
|
||||
} catch (e) {
|
||||
initializeNewTopic()
|
||||
}
|
||||
if(!actualTopic) {
|
||||
initializeNewTopic()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue