fix a bug in Ox.decodeDeflate (slice(1,-0) returns '')

This commit is contained in:
rolux 2012-05-25 11:43:38 +02:00
parent 12296c41db
commit bf02d50909

View file

@ -223,7 +223,9 @@ Ox.decodeDeflate = function(string, callback) {
try { try {
// Parse the first byte as number of bytes to chop at the end, // Parse the first byte as number of bytes to chop at the end,
// and the rest, without these bytes, as an UTF8-encoded string. // and the rest, without these bytes, as an UTF8-encoded string.
string = Ox.decodeUTF8(string.slice(1, -string.charCodeAt(0))); string = Ox.decodeUTF8(
string.slice(1, -string.charCodeAt(0) || void 0)
);
} catch (e) { } catch (e) {
error(); error();
} }