From 628d817348e8177fc4a6c31b0719e298a9466048 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 2 Jan 2024 15:01:27 +0000 Subject: [PATCH] Show error when missing caliber data in `drawAmmoTpl()` --- project/src/helpers/ItemHelper.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index efa8fc5d..4929afde 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -1105,7 +1105,13 @@ export class ItemHelper protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string { const ammoArray = new ProbabilityObjectArray(this.mathUtil, this.jsonUtil); - for (const icd of staticAmmoDist[caliber]) + const ammos = staticAmmoDist[caliber]; + if (!ammos) + { + this.logger.error(`missing caliber data for: ${caliber}`); + } + + for (const icd of ammos) { ammoArray.push(new ProbabilityObject(icd.tpl, icd.relativeProbability)); }