From: Anthony Geay Date: Fri, 6 May 2016 12:51:59 +0000 (+0200) Subject: Protect against load of empty MED file. X-Git-Tag: V8_1_0a1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8609543a5b85678345d29d83b0642b4375ad7918;p=modules%2Fparavis.git Protect against load of empty MED file. --- diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.cxx index f06f0616..c6f74bbb 100644 --- a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.cxx +++ b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.cxx @@ -73,6 +73,9 @@ void pqMEDReaderFieldsWidget::loadTreeWidgetItems() vtkStringArray* names = vtkStringArray::SafeDownCast(tree->GetVertexData()->GetAbstractArray("Names")); + if(!names)// In case of error right at the begining of loading process (empty MED file) + return ; + vtkIdType root = tree->GetRoot(); vtkIdType fst = tree->GetChild(root, 0); // FieldsStatusTree diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx index 2aaf97f5..60e57e14 100644 --- a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx +++ b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx @@ -77,6 +77,9 @@ pqMEDReaderTimesFlagsWidget::pqMEDReaderTimesFlagsWidget( this->addPropertyLink(this, "timeSteps", SIGNAL(timeStepsChanged()), smproxy, smproperty); + if(!this->TimesVectWidget) // In case of error right at the begining of loading process (empty MED file) + return ; + const QMap& items(this->TimesVectWidget->getItems()); QMap::const_iterator it; for (it = items.begin(); it != items.end(); it++) @@ -103,6 +106,8 @@ QList< QList< QVariant> > pqMEDReaderTimesFlagsWidget::getTimeSteps() const // Put together a TimeStep list, using ItemMap QList< QList< QVariant> > ret; QList< QVariant > timeStep; + if(!this->TimesVectWidget) // In case of error right at the begining of loading process (empty MED file) + return ret; const QMap& items(this->TimesVectWidget->getItems()); QMap::const_iterator it; for (it = items.begin(); it != items.end(); it++) @@ -165,6 +170,9 @@ void pqMEDReaderTimesFlagsWidget::CreateTimesVectWidget() delete this->TimesVectWidget; } + if(!graph) + return ;// In case of error right at the begining of loading process (empty MED file) + // (Re)cretate widget this->TimesVectWidget = new VectBoolWidget(this, pqMedReaderGraphUtils::getMaxNumberOfTS(graph));