Skip to content

Commit db3cf1f

Browse files
committed
Write null when ReadI fails to prevent confusion
1 parent 4a3bc3e commit db3cf1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/src/mindustry/logic/LExecutor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,12 +619,17 @@ public ReadI(){
619619
public void run(LExecutor exec){
620620
Object targetObj = target.obj();
621621
if(targetObj instanceof LReadable read){
622-
if(!read.readable(exec)) return;
622+
if(!read.readable(exec)){
623+
output.setobj(null);
624+
return;
625+
}
623626
read.read(position, output);
624627
}else{
625628
int address = position.numi();
626629
if(targetObj instanceof CharSequence str){
627630
output.setnum(address < 0 || address >= str.length() ? Double.NaN : (int)str.charAt(address));
631+
}else{
632+
output.setobj(null);
628633
}
629634
}
630635
}

0 commit comments

Comments
 (0)