Skip to content

Commit 4f2271d

Browse files
Zsombor Erdődy-Nagystevegury
authored andcommitted
Small code style consistency fix for WeakSingleProducer (#3901)
- Handling the case of 0 requests with the same style as SingleDelayedProducer and SingleProducer.
1 parent 191f023 commit 4f2271d

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/main/java/rx/internal/util/ScalarSynchronousObservable.java

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -255,25 +255,26 @@ public void request(long n) {
255255
if (n < 0L) {
256256
throw new IllegalStateException("n >= required but it was " + n);
257257
}
258-
if (n != 0L) {
259-
once = true;
260-
Subscriber<? super T> a = actual;
261-
if (a.isUnsubscribed()) {
262-
return;
263-
}
264-
T v = value;
265-
try {
266-
a.onNext(v);
267-
} catch (Throwable e) {
268-
Exceptions.throwOrReport(e, a, v);
269-
return;
270-
}
271-
272-
if (a.isUnsubscribed()) {
273-
return;
274-
}
275-
a.onCompleted();
258+
if (n == 0L) {
259+
return;
260+
}
261+
once = true;
262+
Subscriber<? super T> a = actual;
263+
if (a.isUnsubscribed()) {
264+
return;
265+
}
266+
T v = value;
267+
try {
268+
a.onNext(v);
269+
} catch (Throwable e) {
270+
Exceptions.throwOrReport(e, a, v);
271+
return;
276272
}
273+
274+
if (a.isUnsubscribed()) {
275+
return;
276+
}
277+
a.onCompleted();
277278
}
278279
}
279280
}

0 commit comments

Comments
 (0)