diff --git a/native/XPlatLauncher/src/java.rs b/native/XPlatLauncher/src/java.rs index 00a216e6c196..7bce1f73c707 100644 --- a/native/XPlatLauncher/src/java.rs +++ b/native/XPlatLauncher/src/java.rs @@ -259,9 +259,12 @@ fn convert_vm_options(vm_options: Vec) -> Result> { let acp_len = unsafe { WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, ucs_str.as_wide(), Some(&mut acp_bytes), PCSTR::null(), Some(&mut failed)) }; - if acp_len == 0 || failed.as_bool() { + if acp_len == 0 { bail!("Cannot convert VM option string '{}' to ANSI code page ({}): {}", opt, acp, std::io::Error::last_os_error()); } + if failed.as_bool() { + bail!("Cannot convert VM option string '{}' to ANSI code page ({})", opt, acp); + } CString::new(acp_bytes) }.with_context(|| format!("Invalid VM option string: '{}'", opt))?; strings.push(str);