From 436edfde66e015da99494db2e7a79cb59cbefc0d Mon Sep 17 00:00:00 2001
From: glax <johanna@bernloehr.eu>
Date: Mon, 31 Jul 2023 22:58:41 +0200
Subject: [PATCH] Fix issue where closed connection crashes api

---
 Tranga/API/Server.cs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Tranga/API/Server.cs b/Tranga/API/Server.cs
index ae913ed..8d19bc4 100644
--- a/Tranga/API/Server.cs
+++ b/Tranga/API/Server.cs
@@ -82,12 +82,11 @@ public class Server
             response.OutputStream.Write(content is not null
                 ? Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(content))
                 : Array.Empty<byte>());
+            response.OutputStream.Close();
         }
         catch (HttpListenerException)
         {
             
         }
-        response.OutputStream.Close();
-        
     }
 }
\ No newline at end of file