From 542a5b6fc8d0479c861a14193edd2a7d1d7b0dbd Mon Sep 17 00:00:00 2001 From: Angelica Ochoa <15623749+ao508@users.noreply.github.com> Date: Mon, 31 Jul 2023 14:47:15 -0400 Subject: [PATCH] Handle NPE in getNextSampleIncrement() Signed-off-by: Angelica Ochoa <15623749+ao508@users.noreply.github.com> --- .../smile/service/impl/CmoLabelGeneratorServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/mskcc/smile/service/impl/CmoLabelGeneratorServiceImpl.java b/src/main/java/org/mskcc/smile/service/impl/CmoLabelGeneratorServiceImpl.java index 7381a0f..53bd079 100644 --- a/src/main/java/org/mskcc/smile/service/impl/CmoLabelGeneratorServiceImpl.java +++ b/src/main/java/org/mskcc/smile/service/impl/CmoLabelGeneratorServiceImpl.java @@ -462,6 +462,10 @@ private Integer getNextSampleIncrement(List samples) { // to prevent accidentally giving samples the same counter Integer maxIncrement = 0; for (SampleMetadata sample : samples) { + // skip samples without a defined cmo sample label + if (StringUtils.isBlank(sample.getCmoSampleName())) { + continue; + } // skip cell line samples if (CMO_CELLLINE_ID_REGEX.matcher(sample.getCmoSampleName()).find()) { continue;