fix crash when rules do not define a unicorn item

This commit is contained in:
Enno Rehling 2015-11-03 17:33:44 +01:00
parent 15ff621cbb
commit cc89e9c9da
1 changed files with 5 additions and 4 deletions

View File

@ -1116,7 +1116,6 @@ double magic_resistance(unit * target)
{
attrib *a;
curse *c;
int n;
const curse_type * ct_goodresist = 0, *ct_badresist = 0;
const resource_type *rtype;
double probability = u_race(target)->magres;
@ -1133,10 +1132,12 @@ double magic_resistance(unit * target)
/* Unicorn +10 */
rtype = get_resourcetype(R_UNICORN);
n = i_get(target->items, rtype->itype);
if (rtype) {
int n = i_get(target->items, rtype->itype);
if (n) {
probability += n * 0.1 / target->number;
}
}
/* Auswirkungen von Zaubern auf der Region */
a = a_find(target->region->attribs, &at_curse);