Skip to content

Commit 6f1829c

Browse files
committed
Fixed a missing type check
1 parent edf7645 commit 6f1829c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

javaobj/v2/transformers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
# Javaobj
3939
from .api import ObjectTransformer
40-
from .beans import JavaInstance, JavaClassDesc, FieldType
40+
from .beans import JavaInstance, JavaClassDesc, FieldType, BlockData
4141
from ..constants import TerminalCode, TypeCode
4242
from ..utils import to_bytes, log_error, log_debug, read_struct, read_string
4343

@@ -323,6 +323,9 @@ def load_from_instance(self, indent=0):
323323
# Lists have their content in there annotations
324324
for cd, annotations in self.annotations.items():
325325
if cd.name in self.HANDLED_CLASSES:
326+
if not isinstance(annotations[0], BlockData):
327+
raise ValueError("Require a BlockData as annotation")
328+
326329
# Convert back annotations to bytes
327330
# latin-1 is used to ensure that bytes are kept as is
328331
content = to_bytes(annotations[0].data, "latin1")

0 commit comments

Comments
 (0)