| 1 |
From a86712d1aae9a1a6d2004db3fc8fcdac6ef6b782 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Thomas Krijnen <[email protected]> |
| 3 |
Date: Sun, 7 Jun 2020 15:25:18 +0200 |
| 4 |
Subject: [PATCH] Don't segfault on empty Nef_nary_x |
| 5 |
|
| 6 |
--- |
| 7 |
Nef_3/include/CGAL/Nef_nary_intersection_3.h | 3 ++- |
| 8 |
Nef_3/include/CGAL/Nef_nary_union_3.h | 3 ++- |
| 9 |
2 files changed, 4 insertions(+), 2 deletions(-) |
| 10 |
|
| 11 |
diff --git a/Nef_3/include/CGAL/Nef_nary_intersection_3.h b/Nef_3/include/CGAL/Nef_nary_intersection_3.h |
| 12 |
index 70fc5791fae..5178705dc2f 100644 |
| 13 |
--- a/Nef_3/include/CGAL/Nef_nary_intersection_3.h |
| 14 |
+++ b/Nef_3/include/CGAL/Nef_nary_intersection_3.h |
| 15 |
@@ -52,7 +52,8 @@ class Nef_nary_intersection_3 { |
| 16 |
} |
| 17 |
|
| 18 |
Polyhedron get_intersection() { |
| 19 |
- |
| 20 |
+ if (queue.empty()) |
| 21 |
+ return empty; |
| 22 |
while(queue.size() > 1) |
| 23 |
intersect(); |
| 24 |
inserted = 0; |
| 25 |
diff --git a/Nef_3/include/CGAL/Nef_nary_union_3.h b/Nef_3/include/CGAL/Nef_nary_union_3.h |
| 26 |
index ecbbae2db59..c8663bb911b 100644 |
| 27 |
--- a/Nef_3/include/CGAL/Nef_nary_union_3.h |
| 28 |
+++ b/Nef_3/include/CGAL/Nef_nary_union_3.h |
| 29 |
@@ -52,7 +52,8 @@ class Nef_nary_union_3 { |
| 30 |
} |
| 31 |
|
| 32 |
Polyhedron get_union() { |
| 33 |
- |
| 34 |
+ if (queue.empty()) |
| 35 |
+ return empty; |
| 36 |
while(queue.size() > 1) |
| 37 |
unite(); |
| 38 |
inserted = 0; |