Fix crash when opening context menu with multiple selected views.

This commit is contained in:
Bjørnar Grip Fjær 2017-03-31 17:10:51 +02:00
parent d15b2e5196
commit 4900f50160

View File

@ -42,6 +42,11 @@ bool RicPasteTimeHistoryCurveFeature::isCommandEnabled()
{
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
if (!destinationObject)
{
return false;
}
RimSummaryPlot* summaryPlot = nullptr;
destinationObject->firstAncestorOrThisOfType(summaryPlot);
if (!summaryPlot)
@ -58,6 +63,7 @@ bool RicPasteTimeHistoryCurveFeature::isCommandEnabled()
void RicPasteTimeHistoryCurveFeature::onActionTriggered(bool isChecked)
{
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
CVF_ASSERT(destinationObject);
RimSummaryPlot* summaryPlot = nullptr;
destinationObject->firstAncestorOrThisOfType(summaryPlot);