Merge pull request #1275 from Azaezel/alpha41/collideCrash

work around collide not returning false with a null object
This commit is contained in:
Brian Roberts 2024-05-07 13:48:45 -05:00 committed by GitHub
commit b6f250e93c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1999,7 +1999,7 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event)
if ( !mHitObject ) if ( !mHitObject )
{ {
SceneObject *hitObj = NULL; SceneObject *hitObj = NULL;
if ( collide(event, &hitObj) && !hitObj->isDeleted() && hitObj->isSelectionEnabled() && !objClassIgnored(hitObj) ) if ( collide(event, &hitObj) && hitObj && !hitObj->isDeleted() && hitObj->isSelectionEnabled() && !objClassIgnored(hitObj) )
{ {
mHitObject = hitObj; mHitObject = hitObj;
} }
@ -2060,7 +2060,7 @@ void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event)
} }
SceneObject *hitObj = NULL; SceneObject *hitObj = NULL;
if ( collide( event, &hitObj ) && hitObj->isSelectionEnabled() && !objClassIgnored( hitObj ) ) if ( collide( event, &hitObj ) && hitObj && hitObj->isSelectionEnabled() && !objClassIgnored( hitObj ) )
{ {
mPossibleHitObject = hitObj; mPossibleHitObject = hitObj;
mNoMouseDrag = true; mNoMouseDrag = true;