Skip to content

Commit b8a9beb

Browse files
authored
Fix JDK count variable initialization in setup_java (#9058)
1 parent 6cccb49 commit b8a9beb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

misc/tools.func

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,8 +2787,9 @@ function setup_java() {
27872787
fi
27882788

27892789
# Validate INSTALLED_VERSION is not empty if matched
2790-
local JDK_COUNT=$(dpkg -l 2>/dev/null | grep -c "temurin-.*-jdk" || echo "0")
2791-
if [[ -z "$INSTALLED_VERSION" && "$JDK_COUNT" -gt 0 ]]; then
2790+
local JDK_COUNT=0
2791+
JDK_COUNT=$(dpkg -l 2>/dev/null | grep -c "temurin-.*-jdk" || echo "0")
2792+
if [[ -z "$INSTALLED_VERSION" && "${JDK_COUNT:-0}" -gt 0 ]]; then
27922793
msg_warn "Found Temurin JDK but cannot determine version"
27932794
INSTALLED_VERSION="0"
27942795
fi

0 commit comments

Comments
 (0)