commit | c76372c062b6f3cb39b501823726a2cf4fa581e4 | [log] [tgz] |
---|---|---|
author | Simeon Andreev <simeon.danailov.andreev@gmail.com> | Mon Jan 31 16:20:12 2022 +0100 |
committer | Jeff Johnston <jjohnstn@redhat.com> | Fri Feb 11 20:13:44 2022 -0500 |
tree | 17d6aa7a2a1386b3140e9a4f7988a57078e0325b | |
parent | 25da85adf18ac075ac94dccab56eae2a46ca99e3 [diff] |
Bug 578490 - NPE in CPListElement.toString() Avoid throwing a NPE in CPListElement.toString() if the classpath entry could not be created (e.g. due to entry kind set to -1). Change-Id: Ie6092f5dde61122bfd264de98c7486bec17b7b20 Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com> Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/190208 Tested-by: JDT Bot <jdt-bot@eclipse.org> Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java index 263a966..e539ffa 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java
@@ -632,7 +632,11 @@ @Override public String toString() { - return getClasspathEntry().toString(); + IClasspathEntry classpathEntry= getClasspathEntry(); + if (classpathEntry != null) { + return classpathEntry.toString(); + } + return "null"; //$NON-NLS-1$ } /**