diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java index 862d72c28f..450932b129 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java @@ -167,11 +167,8 @@ public class SessionFactoryRegistry { public SessionFactory getNamedSessionFactory(String name) { LOG.debugf( "Lookup: name=%s", name ); final String uuid = nameUuidXref.get( name ); - if ( uuid != null ) { - return getSessionFactory( uuid ); - } else { - return null; - } + // protect against NPE -- see HHH-8428 + return uuid == null ? null : getSessionFactory( uuid ); } public SessionFactory getSessionFactory(String uuid) {