about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-06 18:57:46 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-06 18:57:46 -0700
commitf7afc61b225e3e9e72da312de9a9cca1d4284688 (patch)
tree83a547707a2a026362aaa71cc7f1ce84af07374d
parentf0e967d2a1d9d7ceee5812accb5501b73c17ec39 (diff)
downloadlines.love-f7afc61b225e3e9e72da312de9a9cca1d4284688.tar.gz
fix a crash
This one isn't worth debugging. We know how to recreate this data on
demand.
-rw-r--r--text.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/text.lua b/text.lua
index 27900c8..3b910e9 100644
--- a/text.lua
+++ b/text.lua
@@ -674,7 +674,9 @@ function Text.to_pos_on_line(line, mx, my)
   if line.screen_line_starting_pos == nil then
     return Text.nearest_cursor_pos(line.data, mx)
   end
-  assert(line.fragments)
+  if line.fragments == nil then
+    Text.compute_fragments(line, Line_width)
+  end
   assert(my >= line.y)
   -- duplicate some logic from Text.draw
   local y = line.y