GH-3324. fix NPE in StdIntFlowContext

Fixes https://github.com/spring-projects/spring-integration/issues/3324

The `StandardIntegrationFlowContext.remove()` has a possible NPE

**Cherry-pick to 5.3.x & 5.2.x**

(cherry picked from commit 7424cb215c)
This commit is contained in:
Alexander Shaklein
2020-07-04 22:58:49 +03:00
committed by Artem Bilan
parent 6d60b9065b
commit d44feadc79

View File

@@ -44,6 +44,7 @@ import org.springframework.util.StringUtils;
*
* @author Artem Bilan
* @author Gary Russell
* @author Alexander Shaklein
*
* @since 5.1
*
@@ -177,8 +178,8 @@ public final class StandardIntegrationFlowContext implements IntegrationFlowCont
*/
@Override
public void remove(String flowId) {
if (this.registry.containsKey(flowId)) {
IntegrationFlowRegistration flowRegistration = this.registry.remove(flowId);
final IntegrationFlowRegistration flowRegistration = this.registry.remove(flowId);
if (flowRegistration != null) {
flowRegistration.stop();
removeDependantBeans(flowId);