Skip to content

Commit ea07e83

Browse files
mp911dechristophstrobl
authored andcommitted
Guard against potential NPE.
Original Pull Request: #4463
1 parent 501a1cc commit ea07e83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/QueryOperations.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ <T> Document getMappedQuery(@Nullable MongoPersistentEntity<T> domainType) {
811811

812812
Document mappedQuery = super.getMappedQuery(domainType);
813813

814-
if (multi && update.isIsolated() && !mappedQuery.containsKey("$isolated")) {
814+
if (multi && update != null && update.isIsolated() && !mappedQuery.containsKey("$isolated")) {
815815
mappedQuery.put("$isolated", 1);
816816
}
817817

@@ -907,7 +907,7 @@ void increaseVersionForUpdateIfNecessary(@Nullable MongoPersistentEntity<?> pers
907907
if (persistentEntity != null && persistentEntity.hasVersionProperty()) {
908908

909909
String versionFieldName = persistentEntity.getRequiredVersionProperty().getFieldName();
910-
if (!update.modifies(versionFieldName)) {
910+
if (update != null && !update.modifies(versionFieldName)) {
911911
update.inc(versionFieldName);
912912
}
913913
}

0 commit comments

Comments
 (0)