X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fevent.py;fp=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fevent.py;h=6a6c1185987517c8c930e32b0b545e19b0daf5a8;hb=3e05e718fc5631fc24462032aea0e20ec7f090a3;hp=08d6ae0949b108ccb9be366740ebb98fa4d6cb94;hpb=afdd1f8201f579d81959ce85759dcc62fcc0a85d;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/event.py b/src/bindings/python/bt2/bt2/event.py index 08d6ae09..6a6c1185 100644 --- a/src/bindings/python/bt2/bt2/event.py +++ b/src/bindings/python/bt2/bt2/event.py @@ -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)