From cfade799825efbba1a1f605dcd142fa88ca29f1c Mon Sep 17 00:00:00 2001 From: Awesome-E <54484616+Awesome-E@users.noreply.github.com> Date: Sun, 15 Sep 2024 20:49:42 -0700 Subject: [PATCH] fix nonexistent key lookup --- src/modules/database.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/database.js b/src/modules/database.js index 76d1c85..9d80591 100644 --- a/src/modules/database.js +++ b/src/modules/database.js @@ -19,6 +19,8 @@ const ServerSettings = mongoose.model('server-settings', new mongoose.Schema({ const serverSettingsDB = { get: async function (serverID) { const response = await ServerSettings.findById(serverID).lean() + if (!response) return null + // for auto type recognition to be correct const data = { ...response, key: response._id, _id: undefined } return data