Skip to content

Commit 5376294

Browse files
author
minjk-bl
committed
Fix catching error
1 parent 6212522 commit 5376294

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

js/board/BoardFrame.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -508,19 +508,23 @@ define([
508508

509509
file.text().then(function(data) {
510510
// var parsedData = decodeURIComponent(data);
511-
var jsonList = JSON.parse(data);
512-
// load blocks
513-
that.jsonToBlock(jsonList);
514-
515-
var indexVp = vpFileName.indexOf('.vp');
516-
var saveFileName = vpFileName.slice(0,indexVp);
517-
518-
// show title of board and path
519-
$('#vp_boardTitle').val(saveFileName);
520-
that.tmpState.boardTitle = saveFileName;
521-
that.tmpState.boardPath = vpFilePath;
522-
523-
com_util.renderSuccessMessage('Successfully opened file. (' + vpFileName + ')');
511+
try {
512+
var jsonList = JSON.parse(data);
513+
// load blocks
514+
that.jsonToBlock(jsonList);
515+
516+
var indexVp = vpFileName.indexOf('.vp');
517+
var saveFileName = vpFileName.slice(0,indexVp);
518+
519+
// show title of board and path
520+
$('#vp_boardTitle').val(saveFileName);
521+
that.tmpState.boardTitle = saveFileName;
522+
that.tmpState.boardPath = vpFilePath;
523+
524+
com_util.renderSuccessMessage('Successfully opened file. (' + vpFileName + ')');
525+
} catch (ex) {
526+
com_util.renderAlertModal('Not applicable file contents with vp format! (JSON)');
527+
}
524528
});
525529
});
526530
}

js/com/component/VarSelector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ define([
8484
this.attributes.push({ [key]: value });
8585
}
8686
setValue(value) {
87+
if (value == null || value == undefined) {
88+
value = '';
89+
}
8790
this.defaultValue = value;
8891
if (value.includes('[') && value.includes(']') ) {
8992
// divide it to variable / column

0 commit comments

Comments
 (0)