about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-12-09 09:22:45 -0800
committerKartik K. Agaram <vc@akkartik.com>2023-12-09 09:22:45 -0800
commit961f29613197bace7925d14f492114fea7b81214 (patch)
tree7facfab191be5b2a911761b3fa87503d4d1bc1fa /text.lua
parent366d806515a724d2ad46900de235e42349d181d0 (diff)
downloadlines.love-961f29613197bace7925d14f492114fea7b81214.tar.gz
fix a couple of asserts missed in the recent audit
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua3
1 files changed, 1 insertions, 2 deletions
diff --git a/text.lua b/text.lua
index 44846e3..5222e22 100644
--- a/text.lua
+++ b/text.lua
@@ -912,9 +912,8 @@ function Text.offset(s, pos1)
   if pos1 == 1 then return 1 end
   local result = utf8.offset(s, pos1)
   if result == nil then
-    print(pos1, #s, s)
+    assert(false, ('Text.offset(%d) called on a string of length %d (byte size %d); this is likely a failure to handle utf8\n\n^%s$\n'):format(pos1, utf8.len(s), #s, s))
   end
-  assert(result, "Text.offset returned nil; this is likely a failure to handle utf8")
   return result
 end