Ensure NPE will not be thrown when cancelling a subscription

Issue: SPR-15393
This commit is contained in:
Violeta Georgieva 2017-03-28 14:08:13 +03:00 committed by Arjen Poutsma
parent dea4825a9f
commit 2556178422
2 changed files with 6 additions and 2 deletions

View File

@ -98,7 +98,9 @@ public abstract class AbstractListenerWriteFlushProcessor<T> implements Processo
* Listeners can call this method to cancel further writing.
*/
protected void cancel() {
this.subscription.cancel();
if (this.subscription != null) {
this.subscription.cancel();
}
}

View File

@ -111,7 +111,9 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T,
* Listeners can call this method to cancel further writing.
*/
public void cancel() {
this.subscription.cancel();
if (this.subscription != null) {
this.subscription.cancel();
}
}