From 919e3226003c50582d086ef3817b499e6b455586 Mon Sep 17 00:00:00 2001 From: Davide D'Alto Date: Tue, 13 Dec 2022 17:07:14 +0000 Subject: [PATCH] HHH-15761 Avoid possible NullPointerException In AbstractSqlAstTranslator --- .../org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java index 6635c3c90b..65292c7625 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java @@ -1180,11 +1180,11 @@ public abstract class AbstractSqlAstTranslator implemen // Since we get here, we know that no alias locks were applied. // We only apply locking on the root query though if there is a global lock mode final LockOptions lockOptions = getLockOptions(); - final Boolean followOnLocking = getLockOptions() == null ? Boolean.FALSE : lockOptions.getFollowOnLocking(); + final Boolean followOnLocking = lockOptions == null ? Boolean.FALSE : lockOptions.getFollowOnLocking(); if ( Boolean.TRUE.equals( followOnLocking ) ) { this.lockOptions = null; } - else if ( lockOptions.getLockMode() != LockMode.NONE ) { + else if ( lockOptions != null && lockOptions.getLockMode() != LockMode.NONE ) { final ForUpdateClause forUpdateClause = new ForUpdateClause(); forUpdateClause.merge( getLockOptions() ); forUpdateClause.applyAliases( getDialect().getWriteRowLockStrategy(), querySpec );