mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 03:53:52 +00:00
Fix crash when stealing items with the owner not around (Fixes #1512)
This commit is contained in:
parent
5f5c0c5bff
commit
f935cfc6c9
2 changed files with 4 additions and 1 deletions
|
@ -827,6 +827,8 @@ namespace MWMechanics
|
||||||
// NOTE: int arg can be from itemTaken() so DON'T modify it, since it is
|
// NOTE: int arg can be from itemTaken() so DON'T modify it, since it is
|
||||||
// passed to reportCrime later on in this function.
|
// passed to reportCrime later on in this function.
|
||||||
|
|
||||||
|
// NOTE: victim may be empty
|
||||||
|
|
||||||
// Only player can commit crime
|
// Only player can commit crime
|
||||||
if (player.getRefData().getHandle() != "player")
|
if (player.getRefData().getHandle() != "player")
|
||||||
return false;
|
return false;
|
||||||
|
@ -860,7 +862,7 @@ namespace MWMechanics
|
||||||
mActors.getObjectsInRange(from, radius, neighbors);
|
mActors.getObjectsInRange(from, radius, neighbors);
|
||||||
|
|
||||||
// victim should be considered even beyond alarm radius
|
// victim should be considered even beyond alarm radius
|
||||||
if (from.squaredDistance(Ogre::Vector3(victim.getRefData().getPosition().pos)) > radius*radius)
|
if (!victim.isEmpty() && from.squaredDistance(Ogre::Vector3(victim.getRefData().getPosition().pos)) > radius*radius)
|
||||||
neighbors.push_back(victim);
|
neighbors.push_back(victim);
|
||||||
|
|
||||||
int id = MWBase::Environment::get().getWorld()->getPlayer().getNewCrimeId();
|
int id = MWBase::Environment::get().getWorld()->getPlayer().getNewCrimeId();
|
||||||
|
|
|
@ -111,6 +111,7 @@ namespace MWMechanics
|
||||||
/**
|
/**
|
||||||
* @brief Commit a crime. If any actors witness the crime and report it,
|
* @brief Commit a crime. If any actors witness the crime and report it,
|
||||||
* reportCrime will be called automatically.
|
* reportCrime will be called automatically.
|
||||||
|
* @note victim may be empty
|
||||||
* @param arg Depends on \a type, e.g. for Theft, the value of the item that was stolen.
|
* @param arg Depends on \a type, e.g. for Theft, the value of the item that was stolen.
|
||||||
* @return was the crime reported?
|
* @return was the crime reported?
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue