From 1890840255843eda9abc66cd6f9ab3817de85c6d Mon Sep 17 00:00:00 2001 From: Marc Chambers Date: Thu, 4 Apr 2024 15:31:22 +0100 Subject: [PATCH] Add nil check when opening file in todot (#28) --- statemachine.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/statemachine.lua b/statemachine.lua index f9bcafc..a2b1591 100644 --- a/statemachine.lua +++ b/statemachine.lua @@ -120,6 +120,7 @@ end function machine:todot(filename) local dotfile = io.open(filename,'w') + assert(dotfile~=nil) dotfile:write('digraph {\n') local transition = function(event,from,to) dotfile:write(string.format('%s -> %s [label=%s];\n',from,to,event))