From 7986ab246693e52052689f38d7c5659762410502 Mon Sep 17 00:00:00 2001 From: Joan Varvenne Date: Wed, 21 Sep 2016 15:22:26 +0100 Subject: [PATCH] Fix crash when there's no connection in the banana file. Change-Id: I4e587316e51eb4f9485624a7e35bfc69ffe3b7e4 --- monasca_analytics/banana/deadpathck/config.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/monasca_analytics/banana/deadpathck/config.py b/monasca_analytics/banana/deadpathck/config.py index 6d8244a..bc57af8 100644 --- a/monasca_analytics/banana/deadpathck/config.py +++ b/monasca_analytics/banana/deadpathck/config.py @@ -41,6 +41,13 @@ def deadpathck(banana_file, type_table, emitter=emit.PrintEmitter()): # Look first for all branch that are "dead" connections = banana_file.connections # type: ast.Connection + # If there are no connections everything is considered + # as dead. + if connections is None: + class EmptyConnections(object): + connections = [] + connections = EmptyConnections() + # Collect the nodes and connect them. dag_nodes = {} # Create all the nodes