mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-03 11:38:48 +03:00
Added alternate ArrayBufferToString() implemetation to help with stack overflow error (#4302)
This commit is contained in:
parent
ae112c64e3
commit
b2b9befad9
@ -1043,8 +1043,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method has caused exceptions: https://github.com/Ylianst/MeshCentral/issues/4302
|
||||||
function ArrayBufferToString(buffer) {
|
function ArrayBufferToString(buffer) {
|
||||||
return BinaryToString(String.fromCharCode.apply(null, Array.prototype.slice.apply(new Uint8Array(buffer))));
|
try { return BinaryToString(String.fromCharCode.apply(null, Array.prototype.slice.apply(new Uint8Array(buffer)))); } catch (ex) { }
|
||||||
|
console.log('ArrayBufferToString - Unable to convert ' + buffer.byteLength + ' bytes.');
|
||||||
|
var s = '', u = new Uint8Array(buffer);
|
||||||
|
for (var i = 0; i < buffer.byteLength; i++) { s += String.fromCharCode(u[i]); }
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
function StringToArrayBuffer(string) {
|
function StringToArrayBuffer(string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user