diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java index 40e5730527..76789c606d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java @@ -194,13 +194,21 @@ public final class SnippetUtils { } private void addControllerServicesToSnippet(final FlowSnippetDTO snippetDto) { - for ( final ProcessorDTO processorDto : snippetDto.getProcessors() ) { - addControllerServicesToSnippet(snippetDto, processorDto); + final Set processors = snippetDto.getProcessors(); + if ( processors != null ) { + for ( final ProcessorDTO processorDto : processors ) { + addControllerServicesToSnippet(snippetDto, processorDto); + } } - for ( final ProcessGroupDTO processGroupDto : snippetDto.getProcessGroups() ) { - final FlowSnippetDTO childGroupDto = processGroupDto.getContents(); - addControllerServicesToSnippet(childGroupDto); + final Set childGroups = snippetDto.getProcessGroups(); + if ( childGroups != null ) { + for ( final ProcessGroupDTO processGroupDto : childGroups ) { + final FlowSnippetDTO childGroupDto = processGroupDto.getContents(); + if ( childGroupDto != null ) { + addControllerServicesToSnippet(childGroupDto); + } + } } }