about summary refs log tree commit diff stats
path: root/src/loader/loaderhandle.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-06-20 20:04:14 +0200
committerbptato <nincsnevem662@gmail.com>2024-06-20 20:06:45 +0200
commit2ab1e53b4bc15af3319994fdb25bb739b4b8e6db (patch)
tree22e32f721c783f3ee934498ec95b58f5a117ac67 /src/loader/loaderhandle.nim
parent60dc37269cd2dc8cdf23d9f77680f6af9490032f (diff)
downloadchawan-2ab1e53b4bc15af3319994fdb25bb739b4b8e6db.tar.gz
loader: better error handling
we no longer crash on broken codecs. yay
Diffstat (limited to 'src/loader/loaderhandle.nim')
-rw-r--r--src/loader/loaderhandle.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/loader/loaderhandle.nim b/src/loader/loaderhandle.nim
index 31a41571..42f10c6e 100644
--- a/src/loader/loaderhandle.nim
+++ b/src/loader/loaderhandle.nim
@@ -185,10 +185,13 @@ proc iclose*(handle: LoaderHandle) =
     handle.istream.sclose()
     handle.istream = nil
 
+proc oclose*(output: OutputHandle) =
+  output.ostream.sclose()
+  output.ostream = nil
+
 proc close*(handle: LoaderHandle) =
   handle.iclose()
   for output in handle.outputs:
     #TODO assert not output.registered
     if output.ostream != nil:
-      output.ostream.sclose()
-      output.ostream = nil
+      output.oclose()