coverity scan CID 22511: dereference null return value

This commit is contained in:
Enno Rehling 2015-10-29 09:20:58 +01:00
parent 178a740ecf
commit 4da658584c
1 changed files with 1 additions and 1 deletions

View File

@ -428,7 +428,7 @@ static void sink_ship(region * r, ship * sh, unit * saboteur)
else {
for (d = 0; d != MAXDIRECTIONS; ++d) {
region *rn = rconnect(r, d);
if (!fval(rn->terrain, SEA_REGION) && !move_blocked(NULL, r, rn)) {
if (rn && !fval(rn->terrain, SEA_REGION) && !move_blocked(NULL, r, rn)) {
safety = rn;
probability = OCEAN_SWIMMER_CHANCE;
break;