Fixed IE crash related to console usage. (Issue #1321)

Moved console existence check before the variable is used.  This was causing a crash in Internet Explorer when the console was not enabled (console is off by default).