This is an automated email from the ASF dual-hosted git repository. tandraschko pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/openwebbeans.git
The following commit(s) were added to refs/heads/main by this push: new 03bd96cca OWB-1437 InstanceImpl#destroy might lead to a NPE 03bd96cca is described below commit 03bd96cca262ad7cce76bf95b162f89709c9fbeb Author: Thomas Andraschko <tandrasc...@apache.org> AuthorDate: Mon Jan 15 18:23:04 2024 +0100 OWB-1437 InstanceImpl#destroy might lead to a NPE --- .../org/apache/webbeans/inject/instance/InstanceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java b/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java index 3041db52d..c4bb34882 100644 --- a/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java +++ b/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java @@ -310,12 +310,15 @@ public class InstanceImpl<T> implements Instance<T>, Serializable } else { - CreationalContextImpl<?> creationalContext = creationalContexts.remove(instance); - if (creationalContext == null) + if (creationalContexts != null) { - throw new IllegalArgumentException("instance " + instance + " not produced with this Instance<?>"); + CreationalContextImpl<?> creationalContext = creationalContexts.remove(instance); + if (creationalContext == null) + { + throw new IllegalArgumentException("instance " + instance + " not produced with this Instance<?>"); + } + creationalContext.destroyDependent(instance); } - creationalContext.destroyDependent(instance); } }