From 87b768aafe130a9c6d3438242cc519690836c2e7 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Sat, 16 Sep 2017 01:05:20 -0400 Subject: [PATCH] bt2: trace collection notif. iter.: try to check the query result MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This could fail if the structure is not as expected: just raise bt2.Error in this case. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- .../bt2/trace_collection_notification_iterator.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bindings/python/bt2/bt2/trace_collection_notification_iterator.py b/bindings/python/bt2/bt2/trace_collection_notification_iterator.py index 179ac357..d7f1ae5e 100644 --- a/bindings/python/bt2/bt2/trace_collection_notification_iterator.py +++ b/bindings/python/bt2/bt2/trace_collection_notification_iterator.py @@ -128,12 +128,15 @@ class TraceCollectionNotificationIterator(bt2.notification_iterator._Notificatio end = None # find the trace info for this port's trace by name's prefix - for trace_info in trace_info_res: - if port.name.startswith(str(trace_info['path'])): - range_ns = trace_info['intersection-range-ns'] - begin = range_ns['begin'] - end = range_ns['end'] - break + try: + for trace_info in trace_info_res: + if port.name.startswith(str(trace_info['path'])): + range_ns = trace_info['intersection-range-ns'] + begin = range_ns['begin'] + end = range_ns['end'] + break + except: + pass if begin is None or end is None: raise bt2.Error('cannot find stream intersection range for port "{}"'.format(port.name)) -- 2.34.1