Salome HOME
Addition of a menu Mechanics into filters menu of Paravis.
[modules/paravis.git] / src / Plugins / MEDReader / ParaViewPlugin / pqMEDReaderTimesFlagsWidget.cxx
index 4590a020f5bb582ffc15a6d924646507612e60fe..60e57e14ff12c22fd8d75e37840e0a325a0efb66 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2010-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -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<QString, VectBoolItem*>& items(this->TimesVectWidget->getItems());
   QMap<QString, VectBoolItem*>::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<QString, VectBoolItem*>& items(this->TimesVectWidget->getItems());
   QMap<QString, VectBoolItem*>::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));