diff options
Diffstat (limited to 'js/binary/utils.js')
-rw-r--r-- | js/binary/utils.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/js/binary/utils.js b/js/binary/utils.js index 55a9ccd4..173c416b 100644 --- a/js/binary/utils.js +++ b/js/binary/utils.js @@ -971,8 +971,9 @@ jspb.utils.byteSourceToUint8Array = function(data) { return /** @type {!Uint8Array} */(new Uint8Array(data)); } - if (data.constructor === Buffer) { - return /** @type {!Uint8Array} */(new Uint8Array(data)); + if (typeof Buffer != 'undefined' && data.constructor === Buffer) { + return /** @type {!Uint8Array} */ ( + new Uint8Array(/** @type {?} */ (data))); } if (data.constructor === Array) { |