From d2ae5843449000888d6b661bbdf53c2b7509022d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20WEMAERE?= <32339136+fwemaere@users.noreply.github.com> Date: Tue, 3 Feb 2026 08:57:44 +0100 Subject: [PATCH] fix: prevent IllegalArgumentException when apiVersion is missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: François WEMAERE <32339136+fwemaere@users.noreply.github.com> --- .../reactive/result/condition/VersionRequestCondition.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/VersionRequestCondition.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/VersionRequestCondition.java index e3dbb29237d1..5dcd71e6991d 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/VersionRequestCondition.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/VersionRequestCondition.java @@ -100,9 +100,12 @@ public VersionRequestCondition combine(VersionRequestCondition other) { @Override public @Nullable VersionRequestCondition getMatchingCondition(ServerWebExchange exchange) { + if (this.version == null) { + return this; + } ApiVersionHolder versionHolder = exchange.getRequiredAttribute(HandlerMapping.API_VERSION_ATTRIBUTE); - if (this.version == null || !versionHolder.hasVersion()) { + if (!versionHolder.hasVersion()) { return this; }