mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
avoid errors when trying to call createTasks with no tasks (#10170)
This commit is contained in:
@@ -77,6 +77,9 @@ export async function createTasks (req, res, options = {}) {
|
||||
|
||||
let toSave = Array.isArray(req.body) ? req.body : [req.body];
|
||||
|
||||
// Return if no tasks are passed, avoids errors with mongo $push being empty
|
||||
if (toSave.length === 0) return [];
|
||||
|
||||
let taskOrderToAdd = {};
|
||||
|
||||
toSave = toSave.map(taskData => {
|
||||
|
||||
Reference in New Issue
Block a user