Fix JDK count variable initialization in setup_java (#9058)

This commit is contained in:
CanbiZ 2025-11-11 16:19:35 +01:00 committed by GitHub
parent 6cccb49363
commit b8a9beb56a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2787,8 +2787,9 @@ function setup_java() {
fi
# Validate INSTALLED_VERSION is not empty if matched
local JDK_COUNT=$(dpkg -l 2>/dev/null | grep -c "temurin-.*-jdk" || echo "0")
if [[ -z "$INSTALLED_VERSION" && "$JDK_COUNT" -gt 0 ]]; then
local JDK_COUNT=0
JDK_COUNT=$(dpkg -l 2>/dev/null | grep -c "temurin-.*-jdk" || echo "0")
if [[ -z "$INSTALLED_VERSION" && "${JDK_COUNT:-0}" -gt 0 ]]; then
msg_warn "Found Temurin JDK but cannot determine version"
INSTALLED_VERSION="0"
fi