Browse Source

Guard against potential NPE.

Original Pull Request: #4463
pull/4498/head
Mark Paluch 2 years ago committed by Christoph Strobl
parent
commit
ea07e83552
No known key found for this signature in database
GPG Key ID: 8CC1AB53391458C8
  1. 4
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/QueryOperations.java

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

@ -811,7 +811,7 @@ class QueryOperations {
Document mappedQuery = super.getMappedQuery(domainType); Document mappedQuery = super.getMappedQuery(domainType);
if (multi && update.isIsolated() && !mappedQuery.containsKey("$isolated")) { if (multi && update != null && update.isIsolated() && !mappedQuery.containsKey("$isolated")) {
mappedQuery.put("$isolated", 1); mappedQuery.put("$isolated", 1);
} }
@ -907,7 +907,7 @@ class QueryOperations {
if (persistentEntity != null && persistentEntity.hasVersionProperty()) { if (persistentEntity != null && persistentEntity.hasVersionProperty()) {
String versionFieldName = persistentEntity.getRequiredVersionProperty().getFieldName(); String versionFieldName = persistentEntity.getRequiredVersionProperty().getFieldName();
if (!update.modifies(versionFieldName)) { if (update != null && !update.modifies(versionFieldName)) {
update.inc(versionFieldName); update.inc(versionFieldName);
} }
} }

Loading…
Cancel
Save