diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index 4bf8b7c3bc..0bc13e27f8 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -1789,6 +1789,12 @@ void RicWellPathExportMswCompletionsImpl::assignBranchNumbersToBranch( const Rim { branch->setBranchNumber( *branchNumber ); + for ( auto childBranch : branch->branches() ) + { + ( *branchNumber )++; + assignBranchNumbersToBranch( eclipseCase, exportInfo, childBranch, branchNumber ); + } + // Assign perforations first to ensure the same branch number as the segment for ( auto segment : branch->segments() ) { @@ -1800,13 +1806,6 @@ void RicWellPathExportMswCompletionsImpl::assignBranchNumbersToBranch( const Rim { assignBranchNumbersToOtherCompletions( eclipseCase, segment, branchNumber ); } - - ( *branchNumber )++; - - for ( auto childBranch : branch->branches() ) - { - assignBranchNumbersToBranch( eclipseCase, exportInfo, childBranch, branchNumber ); - } } //--------------------------------------------------------------------------------------------------