File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed
main/java/io/reactivex/internal/operators/observable
test/java/io/reactivex/internal/operators/observable Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -739,7 +739,9 @@ void truncateFinal() {
739
739
/* test */ final void collectValuesInMemory (Collection <? super T > output ) {
740
740
Node next = getHead ();
741
741
for (;;) {
742
- if (next != null ) {
742
+ if (next == null ) {
743
+ break ;
744
+ } else if (next .value != null ) {
743
745
Object o = next .value ;
744
746
Object v = leaveTransform (o );
745
747
if (NotificationLite .isComplete (v ) || NotificationLite .isError (v )) {
@@ -749,8 +751,6 @@ void truncateFinal() {
749
751
if (value != null ) {
750
752
output .add (value );
751
753
}
752
- } else {
753
- break ;
754
754
}
755
755
next = next .get ();
756
756
}
Original file line number Diff line number Diff line change 12
12
*/
13
13
14
14
package io .reactivex .internal .operators .observable ;
15
-
16
15
import static org .junit .Assert .*;
17
16
import static org .mockito .ArgumentMatchers .*;
18
17
import static org .mockito .Mockito .*;
@@ -766,8 +765,7 @@ public void testTimedAndSizedTruncation() {
766
765
767
766
buf .next (3 );
768
767
buf .next (4 );
769
- values .clear ();
770
- buf .collect (values );
768
+ collectAndAssertNoLeaks (buf , values );
771
769
Assert .assertEquals (Arrays .asList (3 , 4 ), values );
772
770
773
771
test .advanceTimeBy (2 , TimeUnit .SECONDS );
@@ -809,8 +807,7 @@ public void testTimedAndSizedTruncationError() {
809
807
810
808
buf .next (3 );
811
809
buf .next (4 );
812
- values .clear ();
813
- buf .collect (values );
810
+ collectAndAssertNoLeaks (buf , values );
814
811
Assert .assertEquals (Arrays .asList (3 , 4 ), values );
815
812
816
813
test .advanceTimeBy (2 , TimeUnit .SECONDS );
You can’t perform that action at this time.
0 commit comments