Handle no data gracefully

This commit is contained in:
Magne Sjaastad 2015-09-18 09:05:15 +02:00
parent 2ebb60e468
commit b3620355de
2 changed files with 24 additions and 2 deletions

View File

@ -75,7 +75,18 @@ void RimWellLogFileCurve::updatePlotData()
if (logFileInfo)
{
RigWellLogFile* wellLogFile = logFileInfo->wellLogFile();
m_plotCurve->setSamples(wellLogFile->values(m_wellLogChannnelName).data(), wellLogFile->depthValues().data(), (int) wellLogFile->depthValues().size());
std::vector<double> values = wellLogFile->values(m_wellLogChannnelName);
std::vector<double> depthValues = wellLogFile->depthValues();
if (values.size() > 0 && depthValues.size() > 0)
{
m_plotCurve->setSamples(values.data(), depthValues.data(), (int) depthValues.size());
}
else
{
m_plotCurve->setSamples(NULL, NULL, 0);
}
}
}
else
@ -204,6 +215,11 @@ QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions(const c
}
}
}
if (optionList.size() == 0)
{
optionList.push_back(caf::PdmOptionItemInfo("None", "None"));
}
}
return optionList;

View File

@ -130,5 +130,11 @@ std::vector<double> RigWellLogFile::values(const QString& name) const
// TODO: Possibly handle discrete logs
CVF_ASSERT(m_wellLogFile);
return m_wellLogFile->GetContLog(name.toStdString());
if (m_wellLogFile->HasContLog(name.toStdString()))
{
return m_wellLogFile->GetContLog(name.toStdString());
}
return std::vector<double>();
}