about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--main.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 17a19e5..4f6fd00 100644
--- a/main.lua
+++ b/main.lua
@@ -128,7 +128,7 @@ function App.initialize(arg)
     end
   else
     Lines = load_from_disk(Filename)
-    if Lines[Cursor1.line].mode ~= 'text' then
+    if Cursor1.line > #Lines or Lines[Cursor1.line].mode ~= 'text' then
       for i,line in ipairs(Lines) do
         if line.mode == 'text' then
           Cursor1.line = i