diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 4cafab41d9..fe56fc3bb8 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3075,6 +3075,11 @@ namespace MWWorld void World::confiscateStolenItems(const Ptr &ptr) { MWWorld::Ptr prisonMarker = getClosestMarker( ptr, "prisonmarker" ); + if ( prisonMarker.isEmpty() ) + { + std::cerr << "Failed to confiscate items: no closest prison marker found." << std::endl; + return; + } std::string prisonName = prisonMarker.mRef->mRef.getDestCell(); if ( prisonName.empty() ) {