Skip to content

Commit

Permalink
Fixed potential NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Sep 3, 2014
1 parent d98a49d commit 464a579
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -129,9 +129,11 @@ public Boolean call() throws Exception
private void initPersistenceUnitName(UIBuilder builder)
{
int i = 1;
String projectName = getSelectedProject(builder.getUIContext()).getFacet(MetadataFacet.class).getProjectName();
Project selectedProject = getSelectedProject(builder.getUIContext());
String projectName = selectedProject == null ? "forge" : selectedProject.getFacet(MetadataFacet.class)
.getProjectName();
String unitName = projectName + PersistenceOperations.DEFAULT_UNIT_SUFFIX;
while (isExistingPersistenceUnitName(getSelectedProject(builder.getUIContext()), unitName))
while (isExistingPersistenceUnitName(selectedProject, unitName))
{
unitName = projectName + PersistenceOperations.DEFAULT_UNIT_SUFFIX + "-" + i++;
}
Expand Down

0 comments on commit 464a579

Please sign in to comment.