mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7361 Janitor : Guard null pointer access
This commit is contained in:
parent
1a28e71b68
commit
ce2dd46a2e
@ -984,7 +984,6 @@ void RimWellAllocationPlot::updateFormationNamesData() const
|
||||
for ( size_t i = 0; i < m_accumulatedWellFlowPlot->plotCount(); ++i )
|
||||
{
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( m_accumulatedWellFlowPlot->plotByIndex( i ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
track->setAndUpdateSimWellFormationNamesData( m_case, m_wellName );
|
||||
|
@ -233,7 +233,6 @@ void RimWellPltPlot::updateFormationsOnPlot() const
|
||||
RimWellPath* wellPath = proj->wellPathByName( m_wellPathName );
|
||||
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
RimCase* formationNamesCase = track->formationNamesCase();
|
||||
@ -484,8 +483,6 @@ public:
|
||||
void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
{
|
||||
RimWellLogTrack* plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( !plotTrack ) return;
|
||||
|
||||
const std::set<RiaRftPltCurveDefinition>& curveDefs = selectedCurveDefs();
|
||||
@ -890,7 +887,6 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
if ( changedField == &m_wellPathName )
|
||||
{
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->deleteAllCurves();
|
||||
@ -934,7 +930,6 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
syncCurvesFromUiSelection();
|
||||
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAutoScaleXEnabled( true );
|
||||
@ -948,7 +943,6 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
syncCurvesFromUiSelection();
|
||||
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAutoScaleXEnabled( true );
|
||||
@ -987,7 +981,6 @@ void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
RimWellLogTrack* const track = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
track->uiOrderingForRftPltFormations( uiOrdering );
|
||||
@ -1105,7 +1098,6 @@ void RimWellPltPlot::onLoadDataAndUpdate()
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
|
@ -192,7 +192,6 @@ void RimWellRftPlot::updateFormationsOnPlot() const
|
||||
|
||||
RimCase* formationNamesCase = nullptr;
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
formationNamesCase = track->formationNamesCase();
|
||||
@ -395,8 +394,6 @@ void RimWellRftPlot::updateEditorsFromCurves()
|
||||
void RimWellRftPlot::syncCurvesFromUiSelection()
|
||||
{
|
||||
RimWellLogTrack* plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( !plotTrack ) return;
|
||||
|
||||
std::set<RiaRftPltCurveDefinition> allCurveDefs = selectedCurveDefs();
|
||||
@ -460,7 +457,6 @@ std::set<RiaRftPltCurveDefinition> RimWellRftPlot::curveDefsFromCurves() const
|
||||
std::set<RiaRftPltCurveDefinition> curveDefs;
|
||||
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
for ( RimWellLogCurve* const curve : plotTrack->curves() )
|
||||
@ -481,7 +477,6 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
|
||||
const QString simWellName = associatedSimWellName();
|
||||
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( !plotTrack ) return;
|
||||
|
||||
// Delete curves
|
||||
@ -966,7 +961,6 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
RimWellLogTrack* const track = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
track->uiOrderingForRftPltFormations( uiOrdering );
|
||||
@ -1056,7 +1050,6 @@ void RimWellRftPlot::onLoadDataAndUpdate()
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
|
||||
@ -1127,7 +1120,6 @@ void RimWellRftPlot::assignWellPathToExtractionCurves()
|
||||
if ( wellPath )
|
||||
{
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
for ( RimWellLogCurve* curve : plotTrack->curves() )
|
||||
|
@ -235,7 +235,12 @@ size_t RimDepthTrackPlot::plotIndex( const RimPlot* plot ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlot* RimDepthTrackPlot::plotByIndex( size_t index ) const
|
||||
{
|
||||
return m_plots[index];
|
||||
if ( index < m_plots.size() )
|
||||
{
|
||||
return m_plots[index];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -272,14 +272,6 @@ size_t RimMultiPlot::plotIndex( const RimPlot* plot ) const
|
||||
return m_plots.index( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlot* RimMultiPlot::plotByIndex( size_t index ) const
|
||||
{
|
||||
return m_plots[index];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -74,9 +74,8 @@ public:
|
||||
void removePlot( RimPlot* plot ) override;
|
||||
void movePlotsToThis( const std::vector<RimPlot*>& plots, int insertAtPosition );
|
||||
|
||||
size_t plotCount() const override;
|
||||
size_t plotIndex( const RimPlot* plot ) const;
|
||||
RimPlot* plotByIndex( size_t index ) const;
|
||||
size_t plotCount() const override;
|
||||
size_t plotIndex( const RimPlot* plot ) const;
|
||||
|
||||
std::vector<RimPlot*> plots() const override;
|
||||
std::vector<RimPlot*> visiblePlots() const;
|
||||
|
Loading…
Reference in New Issue
Block a user