From c088ee57f6bfcc2ecaea813c3d1bf10d11fa1bd5 Mon Sep 17 00:00:00 2001
From: Mohcine Chraibi <m.chraibi@fz-juelich.de>
Date: Thu, 8 Feb 2018 14:15:53 +0100
Subject: [PATCH] Fixes #55

---
 src/SaxParser.cpp | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp
index 79e55bd..660581d 100644
--- a/src/SaxParser.cpp
+++ b/src/SaxParser.cpp
@@ -780,8 +780,23 @@ bool SaxParser::parseGeometryJPS(QString fileName, GeometryFactory& geoFac)
             {
                 Point p1 = tr->GetPoint1();
                 Point p2 = tr->GetPoint2();
-                double z1= tr->GetSubRoom1()->GetElevation(p1);
-                double z2= tr->GetSubRoom1()->GetElevation(p2);
+                double z1 = 0;
+                double z2 = 0;
+                if(! tr->GetSubRoom1())
+                {
+                    std::cout << "Warning: transition " << tr->GetID() << ", " << tr->GetCaption() << " has no subroom1\n";
+                    std::cout << "\t Assume z1=0\n";
+                }
+                else
+                    z1 = tr->GetSubRoom1()->GetElevation(p2);
+                if(! tr->GetSubRoom2())
+                {
+                    std::cout << "Warning: transition " << tr->GetID() << ", " << tr->GetCaption() << " has no subroom2. \n";
+                    std::cout << "\t Assume z2=0\n";
+                }
+                else
+                    z2 = tr->GetSubRoom2()->GetElevation(p1);
+
                 geometry->addDoor(p1._x*FAKTOR, p1._y*FAKTOR, z1*FAKTOR, p2._x*FAKTOR, p2._y*FAKTOR,z2*FAKTOR);
 
                 const Point& p =tr->GetCentre();
-- 
GitLab