Skip to content

Commit

Permalink
Entity: Fix dangling reference in player.torch
Browse files Browse the repository at this point in the history
Fixes: issue #1622
  • Loading branch information
dscharrer committed Jul 8, 2022
1 parent 777752d commit a27febe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -54,6 +54,7 @@ Other Fixes:

* Added a workaround for broken ratman backflip in intro (bug #93)
* Fixed a crash when dragging an entity without a 3D object (bug #1592)
* Fixed a crash when an equipped candle is destroyed (bug #1622)

Technical Changes:

Expand Down
5 changes: 5 additions & 0 deletions src/game/Entity.cpp
Expand Up @@ -57,6 +57,7 @@ ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
#include "game/Inventory.h"
#include "game/Item.h"
#include "game/Levels.h"
#include "game/Player.h"
#include "game/NPC.h"

#include "graphics/data/Mesh.h"
Expand Down Expand Up @@ -272,6 +273,10 @@ void Entity::cleanReferences() {
ioSteal = nullptr;
}

if(player.torch == this) {
player.torch = nullptr;
}

if(!FAST_RELEASE) {
TREATZONE_RemoveIO(this);
}
Expand Down

0 comments on commit a27febe

Please sign in to comment.