From d1d1eb5ca198dbe4f24262f1cae50345e77a7cb1 Mon Sep 17 00:00:00 2001 From: alemidev Date: Wed, 24 Nov 2021 11:16:20 +0100 Subject: [PATCH] TrailingByteArray won't fail on null fields --- aiocraft/mc/types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aiocraft/mc/types.py b/aiocraft/mc/types.py index a31a0fa..d33207b 100644 --- a/aiocraft/mc/types.py +++ b/aiocraft/mc/types.py @@ -225,7 +225,8 @@ class TrailingByteArray(Type): @classmethod def write(cls, data:bytes, buffer:io.BytesIO): - buffer.write(data) + if data: + buffer.write(data) @classmethod def read(cls, buffer:io.BytesIO) -> bytes: