]> zoso.dev Git - buffer.git/commitdiff
check for console.error before using it (for IE5-7)
authorFeross Aboukhadijeh <feross@feross.org>
Thu, 2 Feb 2017 20:00:48 +0000 (12:00 -0800)
committerFeross Aboukhadijeh <feross@feross.org>
Thu, 2 Feb 2017 20:00:48 +0000 (12:00 -0800)
Fixes: https://github.com/feross/buffer/issues/152
index.js

index fb0fc6fe3548c2133567c2e65a0d63ad3b66c903..5dea89c9b4a931d495d54b5f26f00633802cb75a 100644 (file)
--- a/index.js
+++ b/index.js
@@ -34,10 +34,12 @@ exports.kMaxLength = K_MAX_LENGTH
  */
 Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
 
-if (!Buffer.TYPED_ARRAY_SUPPORT) {
+if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
+    typeof console.error === 'function') {
   console.error(
     'This browser lacks typed array (Uint8Array) support which is required by ' +
-    '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.')
+    '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
+  )
 }
 
 function typedArraySupport () {