Skip to content

Commit

Permalink
Dont crash when product is member of disabled category
Browse files Browse the repository at this point in the history
  • Loading branch information
megastary committed Mar 24, 2024
1 parent 836c9de commit f746524
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions routes/edit_product.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ router.post(
}

// Handle barcode change
if (req.body.product_code.length === 0) {
if (req.body.product_code?.length === 0) {
// Make input same type as mongoose scheme
req.body.product_code = undefined;
}
Expand All @@ -149,7 +149,7 @@ router.post(
}

// Handle categories change
if (req.body.product_category.length === 0) {
if (req.body.product_category?.length === 0) {
// Make input same type as mongoose scheme
req.body.product_category = undefined;
}
Expand Down

0 comments on commit f746524

Please sign in to comment.