Fix: _EventConst.__getitem__(): check if event has a packet
[babeltrace.git] / src / bindings / python / bt2 / bt2 / event.py
index 08d6ae0949b108ccb9be366740ebb98fa4d6cb94..6a6c1185987517c8c930e32b0b545e19b0daf5a8 100644 (file)
@@ -123,10 +123,11 @@ class _EventConst(object._UniqueObject):
         if common_context_field is not None and key in common_context_field:
             return common_context_field[key]
 
-        packet_context_field = self.packet.context_field
+        if self.packet:
+            packet_context_field = self.packet.context_field
 
-        if packet_context_field is not None and key in packet_context_field:
-            return packet_context_field[key]
+            if packet_context_field is not None and key in packet_context_field:
+                return packet_context_field[key]
 
         raise KeyError(key)
 
This page took 0.024149 seconds and 4 git commands to generate.