From 119de934d4dc75293dd19fb3ed16832340cafff9 Mon Sep 17 00:00:00 2001 From: tresf Date: Wed, 13 Sep 2023 11:24:34 -0400 Subject: [PATCH] Fix version parsing error on Windows Server 2012 Closes #1176 --- src/qz/utils/WindowsUtilities.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qz/utils/WindowsUtilities.java b/src/qz/utils/WindowsUtilities.java index a2176802c..a6c15fa4f 100644 --- a/src/qz/utils/WindowsUtilities.java +++ b/src/qz/utils/WindowsUtilities.java @@ -79,11 +79,16 @@ public static Version getOsVersion() { build = getRegInt(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "UBR").toString(); } - return Version.forIntegers( + Version osVersion = Version.forIntegers( versionInfo.dwMajorVersion.intValue(), versionInfo.dwMinorVersion.intValue(), versionInfo.dwBuildNumber.intValue() - ).setBuildMetadata(build); + ); + + if(!build.trim().isEmpty()) { + osVersion.setBuildMetadata(build); + } + return osVersion; } /**