From 7b6af2b9f5c3f509e54ca6eebe975a7562531eb7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 14 Sep 2017 12:09:16 -0400 Subject: [PATCH] Fix Python bt2: sequence length field may be NULL MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- bindings/python/bt2/bt2/fields.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bindings/python/bt2/bt2/fields.py b/bindings/python/bt2/bt2/fields.py index afa02d5d..86323686 100644 --- a/bindings/python/bt2/bt2/fields.py +++ b/bindings/python/bt2/bt2/fields.py @@ -654,12 +654,13 @@ class _SequenceField(_ArraySequenceField): _NAME = 'Sequence' def _count(self): - return self.length_field.value + return int(self.length_field) @property def length_field(self): field_ptr = native_bt.ctf_field_sequence_get_length(self._ptr) - utils._handle_ptr("cannot get sequence field object's length field") + if field_ptr is None: + return return _create_from_ptr(field_ptr) @length_field.setter -- 2.34.1