Fix empty statement fields shifting the remaining parameters (#12715)

* Fix empty statement fields shifting remaining parameters

* Fixed unit tests
This commit is contained in:
Cardillan
2026-09-30 17:55:18 -04:00
committed by GitHub
parent 4cc15b84f6
commit e7de4e1a10
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ public abstract class LStatement{
/** Sanitizes variable input strings from text fields into values that will not break logic parsing. */
public static String sanitize(String value){
if(value.length() == 0){
return "";
return "null";
}else if(value.length() == 1){
if(value.charAt(0) == '"' || value.charAt(0) == ';' || value.charAt(0) == ' ' ||
value.charAt(0) == '\n' || value.charAt(0) == '\t' || value.charAt(0) == '#'){
+2 -2
View File
@@ -123,7 +123,7 @@ public class LogicTests{
Arguments.of("a bare single semicolon is invalid", ";", "invalid"),
Arguments.of("a bare single space is invalid", " ", "invalid"),
Arguments.of("a single ordinary character passes through unchanged", "a", "a"),
Arguments.of("empty input stays empty", "", ""),
Arguments.of("empty input gets converted to null", "", "null"),
Arguments.of("a plain already-quoted value is untouched", "\"hello\"", "\"hello\""),
Arguments.of("a unescaped quote at the end gets doubled", "\"hello\\\"", "\"hello\\\\\""),
Arguments.of(
@@ -454,4 +454,4 @@ public class LogicTests{
void crlfLabelsResolveToTheSameJumpLocationAsLfLabels(){
assertDoesNotThrow(() -> load("loop:\r\njump loop always\r\n"));
}
}
}