Add extra verification when creating JSON editor to avoid to look for an element in an empty array

This commit is contained in:
Thiago Bovi de Mendonca 2017-07-10 10:21:33 +02:00
parent b84621d054
commit e8684d7d42
1 changed files with 1 additions and 1 deletions

View File

@ -130,7 +130,7 @@ JSONEditor.prototype._create = function (container, options, json) {
this.options = options || {};
this.json = json || {};
var mode = this.options.modes ? this.options.modes[0] : this.options.mode || 'tree';
var mode = this.options.modes && this.options.modes.length > 0 ? this.options.modes[0] : this.options.mode || 'tree';
this.setMode(mode);
};