From 2236981c79dcc5204115f83722de1186e8ce5147 Mon Sep 17 00:00:00 2001 From: Mitch Miller Date: Wed, 23 Oct 2024 16:14:42 -0400 Subject: [PATCH] preventing an NPE when ChemicalUtils does not have a data file --- .../java/gsrs/module/substance/utils/ChemicalUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gsrs-module-substances-core/src/main/java/gsrs/module/substance/utils/ChemicalUtils.java b/gsrs-module-substances-core/src/main/java/gsrs/module/substance/utils/ChemicalUtils.java index 492a010d..9952fe9f 100644 --- a/gsrs-module-substances-core/src/main/java/gsrs/module/substance/utils/ChemicalUtils.java +++ b/gsrs-module-substances-core/src/main/java/gsrs/module/substance/utils/ChemicalUtils.java @@ -130,7 +130,11 @@ public class ChemicalUtils { @PostConstruct private void setUpSalts() { - log.warn("in setUpSalts, structureHandlingConfiguration.getSaltFilePath(): {}", structureHandlingConfiguration.getSaltFilePath()); + if( structureHandlingConfiguration.getSaltFilePath() == null ) { + log.warn("ChemicalUtils - setUpSalts not initialized"); + return; + } + log.trace("in setUpSalts, structureHandlingConfiguration.getSaltFilePath(): {}", structureHandlingConfiguration.getSaltFilePath()); saltData = new HashMap<>(); try { File file = new File(structureHandlingConfiguration.getSaltFilePath());