From 7d827457b9375263b0458f3507eaab97ab938772 Mon Sep 17 00:00:00 2001
From: Christian Schmitt <chris@ilovelinux.de>
Date: Thu, 18 Oct 2012 16:41:08 +0200
Subject: [PATCH] Keep on constructing if node id is not found (segfaults if
 not caught)

---
 src/BuildTiles/Main/tgconstruct_cleanup.cxx | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/BuildTiles/Main/tgconstruct_cleanup.cxx b/src/BuildTiles/Main/tgconstruct_cleanup.cxx
index 65c5af9b..00703ac3 100644
--- a/src/BuildTiles/Main/tgconstruct_cleanup.cxx
+++ b/src/BuildTiles/Main/tgconstruct_cleanup.cxx
@@ -200,11 +200,14 @@ void TGConstruct::AverageEdgeElevations( void )
 
         /* Find this node, and update it's elevation */
         int idx = nodes.find( faces.node );
-        TGNode node = nodes.get_node( idx );
 
-        if ( !node.GetFixedPosition() ) {
-            // set elevation as the average between all tiles that have it
-            nodes.SetElevation( idx, elevation );
+        if (idx != -1) {
+            TGNode node = nodes.get_node( idx );
+
+            if ( !node.GetFixedPosition() ) {
+                // set elevation as the average between all tiles that have it
+                nodes.SetElevation( idx, elevation );
+            }
         }
     }
-}
\ No newline at end of file
+}