@@ -2102,39 +2102,18 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
21022102 matchesArray = iter . Value . ReadPastArray ( ref failed , static ( ref failed , ref reader ) =>
21032103 {
21042104 // Don't even bother if we've already failed
2105- if ( failed ) return default ;
2106-
2107- if ( ! reader . IsAggregate )
2108- {
2109- failed = true ;
2110- return default ;
2111- }
2112-
2113- var matchChildren = reader . AggregateChildren ( ) ;
2114-
2115- // First range (2-element array: [start, end])
2116- if ( ! ( matchChildren . MoveNext ( ) && TryReadPosition ( ref matchChildren . Value , out var firstPos ) ) )
2117- {
2118- failed = true ;
2119- return default ;
2120- }
2121-
2122- // Second range (2-element array: [start, end])
2123- if ( ! ( matchChildren . MoveNext ( ) && TryReadPosition ( ref matchChildren . Value , out var secondPos ) ) )
2124- {
2125- failed = true ;
2126- return default ;
2127- }
2128-
2129- // Length
2130- if ( ! ( matchChildren . MoveNext ( ) && matchChildren . Value . IsScalar ) )
2105+ if ( ! failed && reader . IsAggregate )
21312106 {
2132- failed = true ;
2133- return default ;
2107+ var matchChildren = reader . AggregateChildren ( ) ;
2108+ if ( matchChildren . MoveNext ( ) && TryReadPosition ( ref matchChildren . Value , out var firstPos )
2109+ && matchChildren . MoveNext ( ) && TryReadPosition ( ref matchChildren . Value , out var secondPos )
2110+ && matchChildren . MoveNext ( ) && matchChildren . Value . IsScalar && matchChildren . Value . TryReadInt64 ( out var length ) )
2111+ {
2112+ return new LCSMatchResult . LCSMatch ( firstPos , secondPos , length ) ;
2113+ }
21342114 }
2135- var length = matchChildren . Value . TryReadInt64 ( out var matchLen ) ? matchLen : 0 ;
2136-
2137- return new LCSMatchResult . LCSMatch ( firstPos , secondPos , length ) ;
2115+ failed = true ;
2116+ return default ;
21382117 } ) ;
21392118
21402119 // Check if anything went wrong
0 commit comments