From bebff57a6a661825d26a17813fe4a3230ac6f9db Mon Sep 17 00:00:00 2001 From: Rodrigo Lima Date: Thu, 23 Apr 2020 15:41:02 -0400 Subject: Fix null pointer warning - Check name and value in method setToscaPresentationValue Issue-ID: SDC-2926 Signed-off-by: Rodrigo Lima Change-Id: I0d66b29c84139afff92065769bf1b79082959333 --- .../org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'common-be') diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java index ee985d3fa1..4637231de6 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java @@ -54,10 +54,12 @@ public abstract class ToscaDataDefinition { } public void setToscaPresentationValue(JsonPresentationFields name, Object value) { - if (toscaPresentation == null && value != null) { - toscaPresentation = new HashMap<>(); + if(name !=null) { + if (toscaPresentation == null) { + toscaPresentation = new HashMap<>(); + } + toscaPresentation.put(name.getPresentation(), value); } - toscaPresentation.put(name.getPresentation(), value); } -- cgit 1.2.3-korg