diff --git a/Post/PViewDataGModel.h b/Post/PViewDataGModel.h index 226396bb00df67e8a24368bd56506c4d16d35ed7..10068b3122055c2e8f288b88b839cbbfeaf4cf67 100644 --- a/Post/PViewDataGModel.h +++ b/Post/PViewDataGModel.h @@ -114,6 +114,7 @@ class stepData{ } Real *getData(int index, bool allocIfNeeded=false, int mult=1) { + if(index < 0) return 0; if(allocIfNeeded){ if(index >= getNumData()) resizeData(index + 100); // optimize this if(!(*_data)[index]){ diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp index 2aa3a337b43a5452dfb8781c965b6afffe8bc52c..991d1a0b5ddb4894565370eb3d3c04db7b9f9eab 100644 --- a/Post/PViewDataGModelIO.cpp +++ b/Post/PViewDataGModelIO.cpp @@ -89,6 +89,7 @@ bool PViewDataGModel::readMSH(const std::string &viewName, const std::string &fi else{ if(fscanf(fp, "%d", &num) != 1) return false; } + if(num < 0) return false; int mult = 1; if(_type == ElementNodeData || _type == GaussPointData){ if(binary){