From 11b60ed39f5828a45536bc7b288880015f050b56 Mon Sep 17 00:00:00 2001 From: 1ue999 <106450442+1ue999@users.noreply.github.com> Date: Sat, 5 Apr 2025 16:50:41 +0200 Subject: [PATCH] Read from string return null out of bounds (#10596) * reading charcodes from strings as inverse of printchar * made it actually work and tested it * make reading invalid index of string return null instead of 0 --- core/src/mindustry/logic/LExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index dfc32d96bb..8f7985b55b 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -579,7 +579,7 @@ public class LExecutor{ output.isobj = fromVar.isobj; } }else if(target.isobj && target.objval instanceof CharSequence str){ - output.setnum(address < 0 || address >= str.length() ? 0 : (int)str.charAt(address)); + output.setnum(address < 0 || address >= str.length() ? Double.NaN : (int)str.charAt(address)); } } }