From 191a98e1dcf339f0601c4f1ff0c405edb6c00a8a Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Tue, 12 May 2026 14:11:06 +1200 Subject: [PATCH] Fix watching registration file before creation --- src/matrix/read-registration.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/matrix/read-registration.js b/src/matrix/read-registration.js index 86f99a1..d1243a7 100644 --- a/src/matrix/read-registration.js +++ b/src/matrix/read-registration.js @@ -78,10 +78,14 @@ function readRegistration() { /** @type {import("../types").AppServiceRegistrationConfig} */ // @ts-ignore let reg = readRegistration() -fs.watch(registrationFilePath, {persistent: false}, () => { - let newReg = readRegistration() - Object.assign(reg, newReg) -}) +if (reg) { + fs.watch(registrationFilePath, {persistent: false}, () => { + let newReg = readRegistration() + if (newReg) { + Object.assign(reg, newReg) + } + }) +} module.exports.registrationFilePath = registrationFilePath module.exports.readRegistration = readRegistration