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,11 +78,15 @@ public class LoadContexts {
public void cleanup(ResultSet resultSet) {
if ( collectionLoadContexts != null ) {
final CollectionLoadContext collectionLoadContext = collectionLoadContexts.remove( resultSet );
collectionLoadContext.cleanup();
if ( collectionLoadContext != null ) {
collectionLoadContext.cleanup();
}
}
if ( entityLoadContexts != null ) {
final EntityLoadContext entityLoadContext = entityLoadContexts.remove( resultSet );
entityLoadContext.cleanup();
if ( entityLoadContext != null ) {
entityLoadContext.cleanup();
}
}
}