Actually fix "Cannot read property env of null" #1029

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@disjunto

Previous "Cannot read property env of null" commit only logged an a message to console and didn't prevent script continuing (and therefore failing)

@nightwing nightwing commented on the diff Oct 13, 2012
lib/ace/ace.js
@@ -67,7 +67,7 @@ exports.edit = function(el) {
if (typeof(el) == "string") {
var _id = el;
if (!(el = document.getElementById(el))) {
- console.log("can't match div #" + _id);
+ return false;
@nightwing
nightwing Oct 13, 2012

why is it good for ace.edit to silently fail here?
shouldn't this be throw "ace.edit can't find div #" + _id; instead?

@disjunto
disjunto Oct 14, 2012

That would probably be a better solution.

was returning false as an easy to check failure of initialisation, logging to console did absolutely nothing to fix the crash of a missing element

@nightwing
Ajax.org B.V. member

replaced console.log with throw.
thanks.

@nightwing nightwing closed this Oct 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment