From b271edb092fffc911bcf626bda65728247764e10 Mon Sep 17 00:00:00 2001 From: msv Date: Wed, 15 May 2019 12:10:36 +0300 Subject: [PATCH] 0030712: Application Framework - Protect binary TriangulationDriver against empty triangulation in the file The matter is that when the binary OCAF file contained a triangulation with 0 nodes and 0 triangles the method Paste would cause construction error of Poly_Triangulation. This patch protects this method against exception. --- src/BinMDataXtd/BinMDataXtd_TriangulationDriver.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/BinMDataXtd/BinMDataXtd_TriangulationDriver.cxx b/src/BinMDataXtd/BinMDataXtd_TriangulationDriver.cxx index 503999b67a..90b65288f0 100644 --- a/src/BinMDataXtd/BinMDataXtd_TriangulationDriver.cxx +++ b/src/BinMDataXtd/BinMDataXtd_TriangulationDriver.cxx @@ -63,6 +63,11 @@ Standard_Boolean BinMDataXtd_TriangulationDriver::Paste(const BinObjMgt_Persiste theSource >> hasUV; theSource >> deflection; + if (!nbNodes || !nbTriangles) + { + return Standard_False; + } + // allocate the mesh Handle(Poly_Triangulation) PT = new Poly_Triangulation(nbNodes, nbTriangles, hasUV);