1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 07:53:53 +00:00

Fix crash in getDistance when invoked before the game starts

This commit is contained in:
scrawl 2018-01-11 01:48:05 +00:00
parent 83726ee06a
commit 1522bda60b
No known key found for this signature in database
GPG key ID: 2E6CC3676024C402

View file

@ -463,7 +463,7 @@ namespace MWScript
const MWWorld::Ptr ref = MWBase::Environment::get().getWorld()->getPtr(name, false); const MWWorld::Ptr ref = MWBase::Environment::get().getWorld()->getPtr(name, false);
// If the objects are in different worldspaces, return a large value (just like vanilla) // If the objects are in different worldspaces, return a large value (just like vanilla)
if (ref.getCell()->getCell()->getCellId().mWorldspace != ref2.getCell()->getCell()->getCellId().mWorldspace) if (!ref.isInCell() || !ref2.isInCell() || ref.getCell()->getCell()->getCellId().mWorldspace != ref2.getCell()->getCell()->getCellId().mWorldspace)
return std::numeric_limits<float>::max(); return std::numeric_limits<float>::max();
double diff[3]; double diff[3];