From 28103b3a1508b3befcf4a512c61a45710f9b54ce Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 28 Oct 2004 07:43:39 +0000 Subject: [PATCH] add error check in Oriente() --- Mesh/Utils.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Mesh/Utils.cpp b/Mesh/Utils.cpp index 6d2ecd433e..6d3cd1ba82 100644 --- a/Mesh/Utils.cpp +++ b/Mesh/Utils.cpp @@ -1,4 +1,4 @@ -// $Id: Utils.cpp,v 1.26 2004-07-16 18:02:20 geuzaine Exp $ +// $Id: Utils.cpp,v 1.27 2004-10-28 07:43:39 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -531,6 +531,14 @@ int Oriente(List_T * cu, double n[3]) N = List_Nbr(cu); + if(N < 3){ + Msg(GERROR, "Unable to orient contour with less than 3 vertices"); + n[0] = 0.; + n[1] = 0.; + n[2] = 1.; + return 0; + } + sum = 0.0; for(i = 0; i < N; i++) { if(i == N - 1) { -- GitLab