Fixed error catching...
This commit is contained in:
parent
30ea4d671e
commit
ac7b31e5a6
|
@ -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)
|
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({
|
return res.json({
|
||||||
success: false,
|
success: false,
|
||||||
response: "No players found!"
|
response: "No players found!"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user