Skip to content

Commit f6fa7ab

Browse files
committed
Fix NRE because of possible absence of removal context
1 parent 76c781b commit f6fa7ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Orm/Xtensive.Orm/Orm/Internals/ReferentialActions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ private static IEntity OnGetReference(AssociationInfo association, IEntity owner
3535
private static void OnClearReference(AssociationInfo association, IEntity owner, IEntity target, SyncContext syncContext, RemovalContext removalContext)
3636
{
3737
var nullIsEntity = owner as IHasNullEntity;
38-
var nullValue = nullIsEntity==null ? null : nullIsEntity.NullEntity;
39-
if (nullValue!=null || association.OwnerField.IsNullable || removalContext.Contains((Entity) owner))
38+
var nullValue = nullIsEntity == null ? null : nullIsEntity.NullEntity;
39+
if (nullValue != null || association.OwnerField.IsNullable || removalContext?.Contains((Entity) owner) == true)
4040
// If field is non-nullable & null value is real null, we should avoid assigning it,
4141
// since this will lead to an error on persist in almost any case;
4242
// but if we won't assign it, it will either fail with ref. constraint violation later,

0 commit comments

Comments
 (0)