Add extra verification when creating JSON editor to avoid to look for an element in an empty array
This commit is contained in:
parent
b84621d054
commit
e8684d7d42
|
@ -130,7 +130,7 @@ JSONEditor.prototype._create = function (container, options, json) {
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
this.json = json || {};
|
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);
|
this.setMode(mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue