utils.js: Fix closure compiler error

Apply changes from this commit:

"Integrated internal changes from Google"
13fd045dbb
This commit is contained in:
David Ostrovsky 2018-12-07 21:56:56 +01:00
parent 3cb0aeca93
commit da775bcb38

View File

@ -971,8 +971,9 @@ jspb.utils.byteSourceToUint8Array = function(data) {
return /** @type {!Uint8Array} */(new Uint8Array(data)); return /** @type {!Uint8Array} */(new Uint8Array(data));
} }
if (data.constructor === Buffer) { if (typeof Buffer != 'undefined' && data.constructor === Buffer) {
return /** @type {!Uint8Array} */(new Uint8Array(data)); return /** @type {!Uint8Array} */ (
new Uint8Array(/** @type {?} */ (data)));
} }
if (data.constructor === Array) { if (data.constructor === Array) {