HHH-14574 Avoid NPEs from LoadContexts.cleanup(ResultSet)

This commit is contained in:
Christoph Dreis 2021-04-23 16:43:04 +02:00 committed by Andrea Boriero
parent 26e858c78b
commit fc3accfbd1
1 changed files with 6 additions and 2 deletions

View File

@ -78,13 +78,17 @@ public class LoadContexts {
public void cleanup(ResultSet resultSet) { public void cleanup(ResultSet resultSet) {
if ( collectionLoadContexts != null ) { if ( collectionLoadContexts != null ) {
final CollectionLoadContext collectionLoadContext = collectionLoadContexts.remove( resultSet ); final CollectionLoadContext collectionLoadContext = collectionLoadContexts.remove( resultSet );
if ( collectionLoadContext != null ) {
collectionLoadContext.cleanup(); collectionLoadContext.cleanup();
} }
}
if ( entityLoadContexts != null ) { if ( entityLoadContexts != null ) {
final EntityLoadContext entityLoadContext = entityLoadContexts.remove( resultSet ); final EntityLoadContext entityLoadContext = entityLoadContexts.remove( resultSet );
if ( entityLoadContext != null ) {
entityLoadContext.cleanup(); entityLoadContext.cleanup();
} }
} }
}
/** /**
* Release internal state associated with *all* result sets. * Release internal state associated with *all* result sets.