X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPlugins%2FMEDReader%2FParaViewPlugin%2FpqMEDReaderTimesFlagsWidget.cxx;h=60e57e14ff12c22fd8d75e37840e0a325a0efb66;hb=9219bccd6fc4782b443ca82522974c0b3327440c;hp=25113c762c94933198f6a59e8dfbb2ba71c6f86c;hpb=88fa99f207bdea2f62e4ecef7421a8c6e00b3ccf;p=modules%2Fparavis.git diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx index 25113c76..60e57e14 100644 --- a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx +++ b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx @@ -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& 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)); @@ -188,10 +196,11 @@ void pqMEDReaderTimesFlagsWidget::UpdateTimeSteps() const char* leafString = prop->GetElement(i - 1); const char* tmp = strchr(leafString, '/'); size_t num = tmp - leafString; - char dest[num]; + char* dest = new char[num]; strncpy(dest, leafString, num); dest[num] = '\0'; tsId = strtol(dest + 2, NULL, 10); + delete dest; break; } }