about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--main.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/main.lua b/main.lua
index 2656477..6992a61 100644
--- a/main.lua
+++ b/main.lua
@@ -710,12 +710,14 @@ function keychord_pressed(chord)
 end
 
 function cursor_x(line, cursor_pos)
+  if type(line) == 'table' then return 0 end
   local line_before_cursor = line:sub(1, cursor_pos-1)
   local text_before_cursor = love.graphics.newText(love.graphics.getFont(), line_before_cursor)
   return text_before_cursor:getWidth()
 end
 
 function nearest_cursor_pos(line, x, hint)
+  if type(line) == 'table' then return hint end
   if x == 0 then
     return 1
   end