Skip to content

Commit

Permalink
#19 Preventing 'TypeError: FoxyCalc_Panel.history is undefined'
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyrne01 committed May 30, 2014
1 parent ca37960 commit 3be87c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions data/js/UserInteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ var FoxyCalc_Panel = {
restoreHistory: function(value){
var parsedValues = JSON.parse(value);

FoxyCalc_Panel.history = parsedValues.history;
FoxyCalc_Panel.currentHistoricalEntry = parsedValues.currentHistoricalEntry;
if (typeof parsedValues.history === 'undefined' || typeof parsedValues.currentHistoricalEntry === 'undefined'){
parsedValues.history = [];
FoxyCalc_Panel.currentHistoricalEntry = 0;

}else{

FoxyCalc_Panel.history = parsedValues.history;
FoxyCalc_Panel.currentHistoricalEntry = parsedValues.currentHistoricalEntry;
}
},

setCaretPosition: function(elemId, caretPos) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"icon":"data/images/icon.png",
"icon64":"data/images/icon64.png",
"license": "GNU GPL v3.0",
"version": "1.1.2",
"version": "1.1.3",
"preferences": [{
"name": "background-color",
"title": "Background color of panel?",
Expand Down

0 comments on commit 3be87c7

Please sign in to comment.