From 2fbabbd4031bace4f100d0efe028ccc356533a49 Mon Sep 17 00:00:00 2001 From: Ishaan Dey <69771365+ishaan1013@users.noreply.github.com> Date: Thu, 27 Jun 2024 23:43:18 -0700 Subject: [PATCH] fix: handle file save bug (#36) --- backend/server/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/server/src/index.ts b/backend/server/src/index.ts index 13ce955..733d366 100644 --- a/backend/server/src/index.ts +++ b/backend/server/src/index.ts @@ -192,6 +192,8 @@ io.on("connection", async (socket) => { // todo: send diffs + debounce for efficiency socket.on("saveFile", async (fileId: string, body: string) => { + if (!fileId) return; // handles saving when no file is open + try { if (Buffer.byteLength(body, "utf-8") > MAX_BODY_SIZE) { socket.emit(