19place
Castles & Crusades Ruleset for Fantasy Grounds VTT All the ideas and discussions
1 vote Vote

Empty Party sheet rolling causes errors

When you open up an empty Party Sheet, pressing either the roll Ability or Party Attack buttons throw errors in the console:

Script Error: [string "ps/scripts/ps_roll_ability.lua"]:22: bad argument #1 to 'pairs' (table expected, got nil)
Script Error: [string "ps/scripts/ps_roll_atk.lua"]:32: bad argument #1 to 'pairs' (table expected, got nil)

Obviously this is a stupid thing to do, but nonetheless, shouldn't see console errors unless something unexpected happens.

phantomwhale, 29.01.2014, 23:50
Response from the site administrator
phantomwhale, 23.03.2014
Scheduled for next release (3.0.4)
Idea status: scheduled

Comments

phantomwhale, 29.01.2014, 23:51
The fix in both scripts appears to be to simply remove these three lines:

if #aParty == 0 then
aParty = nil;
end

Leaving aParty as an empty (but non-nil) list means the lines shown in the errors don't throw an error, and instead just iterate over the loop 0 times (as intended).

Leave a comment