diff --git a/web/src/main/java/org/cbioportal/web/util/StudyViewFilterApplier.java b/web/src/main/java/org/cbioportal/web/util/StudyViewFilterApplier.java index 5f90608ff94..47b3b7505ec 100644 --- a/web/src/main/java/org/cbioportal/web/util/StudyViewFilterApplier.java +++ b/web/src/main/java/org/cbioportal/web/util/StudyViewFilterApplier.java @@ -296,6 +296,10 @@ private List equalityFilterClinicalData(List private List filterMutatedGenes(List mutatedGenefilters, Map molecularProfileMap, List sampleIdentifiers) { + if (sampleIdentifiers == null || sampleIdentifiers.isEmpty()) { + return new ArrayList<>(); + } + for (GeneFilter genefilter : mutatedGenefilters) { List filteredMolecularProfiles = genefilter @@ -364,6 +368,10 @@ private List filterMutatedGenes(List mutatedGenefi private List filterStructuralVariantGenes(List svGenefilters, Map molecularProfileMap, List sampleIdentifiers) { + + if (sampleIdentifiers == null || sampleIdentifiers.isEmpty()) { + return new ArrayList<>(); + } for (GeneFilter genefilter : svGenefilters) { @@ -433,6 +441,10 @@ private List filterStructuralVariantGenes(List svG private List filterCNAGenes(List cnaGeneFilters, Map molecularProfileMap, List sampleIdentifiers) { + + if (sampleIdentifiers == null || sampleIdentifiers.isEmpty()) { + return new ArrayList<>(); + } for (GeneFilter geneFilter : cnaGeneFilters) { diff --git a/web/src/main/java/org/cbioportal/web/util/appliers/AbstractPatientTreatmentFilter.java b/web/src/main/java/org/cbioportal/web/util/appliers/AbstractPatientTreatmentFilter.java index 81e7a003315..30d507d297a 100644 --- a/web/src/main/java/org/cbioportal/web/util/appliers/AbstractPatientTreatmentFilter.java +++ b/web/src/main/java/org/cbioportal/web/util/appliers/AbstractPatientTreatmentFilter.java @@ -8,6 +8,7 @@ import org.cbioportal.web.parameter.filter.AndedPatientTreatmentFilters; import org.springframework.beans.factory.annotation.Autowired; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; @@ -25,6 +26,11 @@ public List filter( List identifiers, StudyViewFilter filter ) { + + if (identifiers == null || identifiers.isEmpty()) { + return new ArrayList<>(); + } + AndedPatientTreatmentFilters filters = getFilters(filter); List sampleIds = identifiers.stream() diff --git a/web/src/main/java/org/cbioportal/web/util/appliers/AbstractSampleTreatmentFilter.java b/web/src/main/java/org/cbioportal/web/util/appliers/AbstractSampleTreatmentFilter.java index 302197c7ee4..c28dcefbcbd 100644 --- a/web/src/main/java/org/cbioportal/web/util/appliers/AbstractSampleTreatmentFilter.java +++ b/web/src/main/java/org/cbioportal/web/util/appliers/AbstractSampleTreatmentFilter.java @@ -8,6 +8,7 @@ import org.cbioportal.web.parameter.filter.AndedSampleTreatmentFilters; import org.springframework.beans.factory.annotation.Autowired; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; @@ -25,6 +26,11 @@ public List filter ( List identifiers, StudyViewFilter filter ) { + + if (identifiers == null || identifiers.isEmpty()) { + return new ArrayList<>(); + } + AndedSampleTreatmentFilters filters = getFilters(filter); List sampleIds = identifiers.stream() diff --git a/web/src/main/java/org/cbioportal/web/util/appliers/ClinicalEventFilterApplier.java b/web/src/main/java/org/cbioportal/web/util/appliers/ClinicalEventFilterApplier.java index 53614a4ca73..adf70d4a782 100644 --- a/web/src/main/java/org/cbioportal/web/util/appliers/ClinicalEventFilterApplier.java +++ b/web/src/main/java/org/cbioportal/web/util/appliers/ClinicalEventFilterApplier.java @@ -9,6 +9,7 @@ import org.springframework.lang.NonNull; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; @@ -25,7 +26,11 @@ public final class ClinicalEventFilterApplier implements StudyViewSubFilterAppli @Override public List filter(@NonNull List toFilter, @NonNull StudyViewFilter filters) { - + + if (toFilter == null || toFilter.isEmpty()) { + return new ArrayList<>(); + } + List studyIds = toFilter.stream() .map(SampleIdentifier::getStudyId) .collect(Collectors.toList());