From ac7b31e5a65645cb699363c53426862d378e34f4 Mon Sep 17 00:00:00 2001 From: BurnyLlama Date: Sun, 3 Oct 2021 19:29:10 +0200 Subject: [PATCH] Fixed error catching... --- api/players/players.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/players/players.js b/api/players/players.js index 0282867..c490f14 100644 --- a/api/players/players.js +++ b/api/players/players.js @@ -54,7 +54,7 @@ playerApi.get('/search', async (req, res) => { const players = await Player.find({ name: { $regex: name, $options: 'i' }}).sort([[sort, order]]).limit(20).skip((page - 1) * 20) - if (!players) + if (!players[0]) return res.json({ success: false, response: "No players found!"