Avoid NPE when resolving collection key for delayed collections

This commit is contained in:
Chris Cranford 2021-03-09 18:38:20 -05:00 committed by Christian Beikov
parent 71f633a8f7
commit 44719e9bb2
1 changed files with 6 additions and 2 deletions

View File

@ -76,7 +76,9 @@ public class DelayedCollectionInitializer extends AbstractCollectionInitializer
// LoggingHelper.toLoggableString( getNavigablePath(), this.collectionKey.getKey() ) // LoggingHelper.toLoggableString( getNavigablePath(), this.collectionKey.getKey() )
// ); // );
// } // }
parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) ); if ( collectionInstance != null ) {
parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) );
}
} }
else { else {
final Object parentKey = parentAccess.getParentKey(); final Object parentKey = parentAccess.getParentKey();
@ -85,7 +87,9 @@ public class DelayedCollectionInitializer extends AbstractCollectionInitializer
collectionAttributeMapping.getCollectionDescriptor(), collectionAttributeMapping.getCollectionDescriptor(),
parentKey parentKey
); );
parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) ); if ( collectionInstance != null ) {
parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) );
}
} }
} }
} }