From f4055485297c2284f4aa600287a671947d546dbd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 12:47:12 +0000 Subject: [PATCH] Harden CLI setting value conversion error handling Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com> Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/d53ef12a-695a-4687-bb53-f467c7121aea --- MinecraftClient/Settings.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index d9df4e1a..b8b3cbca 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -501,7 +501,17 @@ namespace MinecraftClient converted = Convert.ChangeType(input, effectiveType, CultureInfo.InvariantCulture); return true; } - catch + catch (InvalidCastException) + { + converted = null; + return false; + } + catch (FormatException) + { + converted = null; + return false; + } + catch (OverflowException) { converted = null; return false;