fixes NPE as ranged items could be equipped when the actor doesnt even have the skill to do so.

pull/65/head
macniel 2025-11-16 13:35:39 +01:00
parent eca965e434
commit c00a6b11b7
1 changed files with 15 additions and 13 deletions

View File

@ -479,7 +479,8 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
if (fernkampf) {
const fkitems = fernkampf.system.rangedSkills.map((skillInQuestion) => actorData.items.find(p => p.name === skillInQuestion))
fkitems.forEach(skill => {
fkitems?.forEach(skill => {
if (skill) {
context.attacks.push({
name: skill.name,
id: fernkampf._id,
@ -490,6 +491,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
tp: `${fernkampf.system.rangedAttackDamage}`,
ini: `${context.inidice}w6 + ${context.inivalue + fernkampf.system.iniModifier ?? 0}`,
})
}
})
}
if (links) {
@ -500,7 +502,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
meitems.push(item)
}
})
meitems.forEach(skill => {
meitems?.forEach(skill => {
const obj = skill
context.attacks.push({
name: obj.name,
@ -523,7 +525,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
meitems.push(item)
}
})
meitems.forEach(skill => {
meitems?.forEach(skill => {
const obj = skill
context.attacks.push({
name: obj.name,