fix(core): improve null safety and default values in PepHelper
- Add null-conditional operator for dwg.QtyRequired (dwg?.QtyRequired ?? 0) - Use string.Empty instead of null for plate names - Remove unused using statements These changes prevent potential null reference exceptions and provide better default values. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using PepLib;
|
||||
using Material = PepApi.Core.Models.Material;
|
||||
using Part = PepApi.Core.Models.Part;
|
||||
@@ -171,7 +169,7 @@ namespace PepApi.Core
|
||||
var part = new Part
|
||||
{
|
||||
Name = drawing.Name,
|
||||
QtyRequired = dwg.QtyRequired
|
||||
QtyRequired = dwg?.QtyRequired ?? 0
|
||||
};
|
||||
|
||||
UpdateQtyNested(part, nest);
|
||||
@@ -217,7 +215,7 @@ namespace PepApi.Core
|
||||
foreach (var item in uniquePlates)
|
||||
{
|
||||
var plate = item.First();
|
||||
plate.Name = null;
|
||||
plate.Name = string.Empty;
|
||||
plate.Qty = item.Sum((Plate p) => p.Qty);
|
||||
|
||||
combinedPlatesList.Add(plate);
|
||||
|
||||
Reference in New Issue
Block a user