#14112 Contour map: guard null legend config in defineUiOrdering

Selecting a contour map projection in the tree could crash when the
associated legend config was null. RimContourMapProjection::defineUiOrdering
called legendConfig()->uiOrdering() unguarded. Because PdmUiObjectHandle::uiOrdering
is non-virtual, the call entered with a null this and then crashed on the
virtual defineUiOrdering dispatch.

Guard the legendConfig() dereference, matching the existing null checks
elsewhere in the file. Apply the same guard to RimEclipseCellColors::defineUiOrdering.
This commit is contained in:
Magne Sjaastad committed 2026-06-04 16:06:50 +02:00
1 parent 0275191b36
commit ea719c41b3
2 files changed
+5 -2

No files matched your search

@@ -613,7 +613,10 @@ void RimContourMapProjection::defineUiOrdering( QString uiConfigName, caf::PdmUi
} }
} }
legendConfig()->uiOrdering( "NumLevelsOnly", *mainGroup ); if ( legendConfig() )
{
legendConfig()->uiOrdering( "NumLevelsOnly", *mainGroup );
}
mainGroup->add( &m_resolution ); mainGroup->add( &m_resolution );
mainGroup->add( &m_showContourLines ); mainGroup->add( &m_showContourLines );
mainGroup->add( &m_showContourLabels ); mainGroup->add( &m_showContourLabels );
@@ -223,7 +223,7 @@ void RimEclipseCellColors::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd
{ {
RimEclipseResultDefinition::defineUiOrdering( uiConfigName, uiOrdering ); RimEclipseResultDefinition::defineUiOrdering( uiConfigName, uiOrdering );
if ( uiConfigName == "AddLegendLevels" ) if ( uiConfigName == "AddLegendLevels" && legendConfig() )
{ {
legendConfig()->uiOrdering( "NumIntervalsOnly", uiOrdering ); legendConfig()->uiOrdering( "NumIntervalsOnly", uiOrdering );
} }