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
This commit is contained in:
1ue999
2025-04-05 16:50:41 +02:00
committed by GitHub
parent 635a145bcf
commit 11b60ed39f

View File

@@ -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));
}
}
}