Skip to content
Snippets Groups Projects
Commit 599ceed1 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

don't crash on bad input data

parent b20f5c3a
Branches
Tags
No related merge requests found
...@@ -114,6 +114,7 @@ class stepData{ ...@@ -114,6 +114,7 @@ class stepData{
} }
Real *getData(int index, bool allocIfNeeded=false, int mult=1) Real *getData(int index, bool allocIfNeeded=false, int mult=1)
{ {
if(index < 0) return 0;
if(allocIfNeeded){ if(allocIfNeeded){
if(index >= getNumData()) resizeData(index + 100); // optimize this if(index >= getNumData()) resizeData(index + 100); // optimize this
if(!(*_data)[index]){ if(!(*_data)[index]){
......
...@@ -89,6 +89,7 @@ bool PViewDataGModel::readMSH(const std::string &viewName, const std::string &fi ...@@ -89,6 +89,7 @@ bool PViewDataGModel::readMSH(const std::string &viewName, const std::string &fi
else{ else{
if(fscanf(fp, "%d", &num) != 1) return false; if(fscanf(fp, "%d", &num) != 1) return false;
} }
if(num < 0) return false;
int mult = 1; int mult = 1;
if(_type == ElementNodeData || _type == GaussPointData){ if(_type == ElementNodeData || _type == GaussPointData){
if(binary){ if(binary){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment