From: Anthony Geay Date: Mon, 25 Apr 2016 06:32:48 +0000 (+0200) Subject: Protect against load of empty MED file. X-Git-Tag: V7_8_0a2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4864492b76ff475af7a9e3ab2a80bea9d08939d4;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 4064c9c6..7f39f9cb 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));