Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;