From bd97bf1c974903db0e666370aa345d68fe03c0d7 Mon Sep 17 00:00:00 2001 From: Dave Branton Date: Fri, 22 May 2026 15:42:34 +1200 Subject: [PATCH] Sometimes this is null --- src/Controller/ToolsController.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Controller/ToolsController.php b/src/Controller/ToolsController.php index c65ea3ae..b74bffcf 100644 --- a/src/Controller/ToolsController.php +++ b/src/Controller/ToolsController.php @@ -150,14 +150,17 @@ class ToolsController extends AbstractController { foreach ($p->getBomEntries() as $bom_entry) { - $part_id = $bom_entry->getPart()->getID(); - if (array_key_exists($part_id, $combined_bom)) + if ($bom_entry->getPart()) { - $combined_bom[$part_id]['quantity'] += $bom_entry->getQuantity() * $count_for_project; - } - else - { - $combined_bom[$part_id] = array('quantity'=>$bom_entry->getQuantity() * $count_for_project, 'part'=>$bom_entry->getPart()); + $part_id = $bom_entry->getPart()->getID(); + if (array_key_exists($part_id, $combined_bom)) + { + $combined_bom[$part_id]['quantity'] += $bom_entry->getQuantity() * $count_for_project; + } + else + { + $combined_bom[$part_id] = array('quantity'=>$bom_entry->getQuantity() * $count_for_project, 'part'=>$bom_entry->getPart()); + } } } }