From 9bd3ac3e844d26e86d571db81c45c010e030031d Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 24 May 2011 12:38:53 +0000
Subject: [PATCH] avoid crash (workaround ugly polygon/polyhedron code)

---
 Graphics/drawPost.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Graphics/drawPost.cpp b/Graphics/drawPost.cpp
index 36647df5ca..7a5ebafa97 100644
--- a/Graphics/drawPost.cpp
+++ b/Graphics/drawPost.cpp
@@ -270,6 +270,8 @@ static void drawTangentVectorGlyphs(drawContext *ctx, PView *p, int numNodes,
 
 static void drawGlyphs(drawContext *ctx, PView *p)
 {
+  static int numNodesError = 0;
+
   // use adaptive data if available
   PViewData *data = p->getData(true);
   PViewOptions *opt = p->getOptions();
@@ -325,6 +327,15 @@ static void drawGlyphs(drawContext *ctx, PView *p)
             val[j] = new double[9];
           }
         }
+        else{
+          if(numNodesError != numNodes){
+            numNodesError = numNodes;
+            Msg::Error("You should never draw views with > %d nodes per element: use"
+                       "'Adapt visualization grid' to view high-order datasets!",
+                       PVIEW_NMAX);
+          }
+          continue;
+        }
       }
       for(int j = 0; j < numNodes; j++){
         data->getNode(opt->timeStep, ent, i, j, xyz[j][0], xyz[j][1], xyz[j][2]);
-- 
GitLab