From 6a3e549f53edce82c0f817db3aec8e2c803a1e59 Mon Sep 17 00:00:00 2001
From: Daniel Brown <ddb@star.sr.bham.ac.uk>
Date: Tue, 27 May 2014 13:20:59 +0900
Subject: [PATCH] adding in check for no path

---
 pykat/utilities/plotting/beamtrace.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pykat/utilities/plotting/beamtrace.py b/pykat/utilities/plotting/beamtrace.py
index 33e0f30..b7e3158 100644
--- a/pykat/utilities/plotting/beamtrace.py
+++ b/pykat/utilities/plotting/beamtrace.py
@@ -12,6 +12,9 @@ def plot_beam_trace(_kat, from_node, to_node):
         
     components = kat.nodes.getComponentsBetween(from_node, to_node)
 
+    if len(components) == 0:
+        raise pkex.BasePyKatException('Could not find a direct path between nodes %s and %s'%(from_node, to_node))
+        
     nodes = []
 
     for cn in range(len(components)):
-- 
GitLab