Skip to content

Commit dc4a907

Browse files
committed
Fix matching zero-length strings.
1 parent dfc64e2 commit dc4a907

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/main/java/org/byteskript/skript/lang/syntax/literal/StringLiteral.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ else if (escape) {
7979

8080
@Override
8181
public Pattern.Match match(String thing, Context context) {
82+
if (thing.length() < 2) return null;
8283
if (thing.charAt(0) != '"') return null;
8384
if (thing.charAt(thing.length() - 1) != '"') return null;
8485
final String contents = thing.substring(1, thing.length() - 1);

src/test/resources/maths.bsk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ function basic:
2121
assert {d} is 4: "Multiplication failed."
2222
assert {e} is 2: "Square root (syntax) failed."
2323
assert "hello " + "there" is "hello there": "String joining failed."
24+
assert "Hello " + "<there!" is "Hello <there!": "String joining failed."
2425

0 commit comments

Comments
 (0)