Skip to content

Commit

Permalink
Исправлен краш при записи нулевого byteArray
Browse files Browse the repository at this point in the history
  • Loading branch information
Congiary authored Sep 4, 2024
1 parent 525da6d commit 35d3184
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nbt.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@
* @param {Array.<number>|Uint8Array|Buffer} value
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.byteArray] = function(value) {
if(!value) {
console.error('Прилетел null при записи byteArray')
return this;
}
this.int(value.length);
accommodate(value.length);
arrayView.set(value, this.offset);
Expand Down Expand Up @@ -671,4 +675,4 @@
});
}
};
}).apply(typeof exports !== 'undefined' ? exports : (window.nbt = {}));
}).apply(typeof exports !== 'undefined' ? exports : (window.nbt = {}));

0 comments on commit 35d3184

Please sign in to comment.