Skip to content

Commit b6fc96e

Browse files
committedApr 4, 2024
Check for null when calling #getLocation()
1 parent 5f94521 commit b6fc96e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
 

‎org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/PlexusContainerManager.java

+3
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ public IMavenPlexusContainer aquire(IResource basedir) throws Exception {
155155
if(basedir == null || !basedir.isAccessible()) {
156156
return aquire();
157157
}
158+
if(basedir.getLocation() == null) {
159+
return aquire();
160+
}
158161
File file = basedir.getLocation().toFile();
159162
if(file == null) {
160163
return aquire();

‎org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ IFile getPom(IProject project) {
237237
// XXX sensible handling
238238
return null;
239239
}
240-
File baseDir = project.getLocation().toFile();
240+
IPath location = project.getLocation();
241+
if(location == null) {
242+
return project.getFile(IMavenConstants.POM_FILE_NAME);
243+
}
244+
File baseDir = location.toFile();
241245
Optional<File> pom = IMavenToolbox.of(containerManager.getComponentLookup(baseDir)).locatePom(baseDir);
242246
return pom.map(pomFile -> {
243247
IFile file = project.getFile(pomFile.getName());

0 commit comments

Comments
 (0)