From: msv Date: Wed, 15 May 2019 09:10:36 +0000 (+0300) Subject: 0030712: Application Framework - Protect binary TriangulationDriver against empty... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FCR0-720-Hybrid;p=occt-copy.git 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. --- diff --git a/src/BinMDataXtd/BinMDataXtd_TriangulationDriver.cxx b/src/BinMDataXtd/BinMDataXtd_TriangulationDriver.cxx index fa7e565539..1d335f6ed7 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);