From: Steinar H. Gunderson Date: Sat, 1 Sep 2012 23:07:14 +0000 (+0200) Subject: Fix a possible infinite recursion in the BSP splitter. X-Git-Url: https://git.sesse.net/?p=tcxmerge;a=commitdiff_plain;h=726821c014581bc1fad84fbd866ca291cdd80f10;ds=sidebyside Fix a possible infinite recursion in the BSP splitter. --- diff --git a/opt.cc b/opt.cc index bd70b41..bb318a4 100644 --- a/opt.cc +++ b/opt.cc @@ -128,6 +128,13 @@ BSPTreeNode* make_bsp_tree(const vector& remaining_roads) } } + if (left.empty() || right.empty()) { + node->is_leaf = true; + node->left = node->right = NULL; + node->roads_this_node = remaining_roads; + return node; + } + if (left.size() == 0) { node->left = NULL; } else {