Skip to content

Commit

Permalink
Fix crash in getDistance when invoked before the game starts
Browse files Browse the repository at this point in the history
  • Loading branch information
scrawl committed Jan 11, 2018
1 parent 83726ee commit 1522bda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/openmw/mwscript/interpretercontext.cpp
Expand Up @@ -463,7 +463,7 @@ namespace MWScript
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 (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();

double diff[3];
Expand Down

0 comments on commit 1522bda

Please sign in to comment.