about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--app.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/app.lua b/app.lua
index 9bf5e6a..cac1303 100644
--- a/app.lua
+++ b/app.lua
@@ -302,13 +302,15 @@ function App.open_for_writing(filename)
 end
 
 function App.open_for_reading(filename)
-  return {
-    lines = function(self)
-              return App.filesystem[filename]:gmatch('[^\n]+')
-            end,
-    close = function(self)
-            end,
-  }
+  if App.filesystem[filename] then
+    return {
+      lines = function(self)
+                return App.filesystem[filename]:gmatch('[^\n]+')
+              end,
+      close = function(self)
+              end,
+    }
+  end
 end
 
 function App.run_tests()