From eea4d20b982ff3b47f96457cbae51c6a63ddc04e Mon Sep 17 00:00:00 2001 From: Chris Brame Date: Fri, 12 Apr 2019 04:48:20 -0400 Subject: [PATCH] fix(api): v1 crash if ticket _id was incorrect --- src/controllers/api/v1/tickets.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controllers/api/v1/tickets.js b/src/controllers/api/v1/tickets.js index 1ed53b5e3..cb024f47e 100644 --- a/src/controllers/api/v1/tickets.js +++ b/src/controllers/api/v1/tickets.js @@ -716,6 +716,7 @@ apiTickets.update = function (req, res) { var ticketModel = require('../../../models/ticket') ticketModel.getTicketById(oId, function (err, ticket) { if (err) return res.status(400).json({ success: false, error: err.message }) + if (!ticket) return res.status(400).json({ success: false, error: 'Unable to locate ticket. Aborting...' }) async.parallel( [ function (cb) {