Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-05-15 11:23:21 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-05-15 11:23:21 -0700
commit7021b499339ae1e9bede4fe85895108c49b805a4 (patch)
tree2b6ab53d4cabb3166c3972451cd3a7aa86406ceb /src/modules
parent26285e4be7159108e5dba9a79543fff2860e8a69 (diff)
Don't blow up if weapon element missing from trooper counters
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/record_sheet.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js
index 4d8aada..78dbace 100644
--- a/src/modules/record_sheet.js
+++ b/src/modules/record_sheet.js
@@ -41,7 +41,7 @@ function createIcon(number) {
function createRecord(unit) {
const { dataset: { allegiance, number }} = unit,
primaryWeapon = unit.querySelector('.primary-weapon'),
- pw = primaryWeapon.getAttribute('href').replace('#', ''),
+ pw = primaryWeapon?.getAttribute('href').replace('#', '') || 'rifle',
div = document.createElement('div', { is: 'soldier-record-block' }),
spans = Array(5).fill('span').map(t => document.createElement(t)),
[tn, pwt, pwd, pwrs, pwrl] = spans;