Skip to content

Commit bb20f22

Browse files
authored
Fix Evanescence or whatever crash on 0/1 deletions
1 parent 8156073 commit bb20f22

File tree

1 file changed

+2
-2
lines changed
  • Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm

1 file changed

+2
-2
lines changed

Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/CastingVM.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ class CastingVM(var image: CastingImage, val env: CastingEnvironment) {
192192
}
193193

194194
SpecialPatterns.EVANITION.angles -> {
195-
val newParens = this.image.parenthesized.init()
196-
val last = newParens.last()
195+
val newParens = if (this.image.parenthesized.isEmpty()) Vector.empty() else this.image.parenthesized.init()
196+
val last = if (this.image.parenthesized.isEmpty()) null else this.image.parenthesized.last()
197197
val newParenCount = this.image.parenCount + if (last == null || last.escaped || last.iota !is PatternIota) 0 else when (last.iota.pattern) {
198198
SpecialPatterns.INTROSPECTION -> -1
199199
SpecialPatterns.RETROSPECTION -> 1

0 commit comments

Comments
 (0)