@samitouri / QOS-React-2 / commits / 6b593083ed

check that console exists before warning

Console is undefined in earlier versions of IE when it is not open. This causes an uncaught exception, and breaks applications in these versions of IE when attempting to warn when the console is closed. Admittedly, console will usually be open when testing in development, but still React should not break the application when it is not.

Darcy committed Mar 4, 2015 at 10:43 UTC 6b593083edc55d0c37b5e074f416f0b0613fda33
1 file changed +3 -1
src/vendor/core/warning.js
+3 -1
@@ -45,7 +45,9 @@ if (__DEV__) {
45 if (!condition) {
46 var argIndex = 0;
47 var message = 'Warning: ' + format.replace(/%s/g, () => args[argIndex++]);
48 - console.warn(message);
48 + if (typeof console !== 'undefined') {
49 + console.warn(message);
50 + }
51 try {
52 // --- Welcome to debugging React ---
53 // This error was thrown as a convenience so that you can use this stack