From 4a5b8c927f6972c4635fab87ec559ad431d10c02 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sat, 25 Feb 2017 12:44:20 +0200 Subject: [PATCH] [Server] Add an extra check to Cell::sendToLoaded to be on the safe side --- apps/openmw-mp/Cell.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/openmw-mp/Cell.cpp b/apps/openmw-mp/Cell.cpp index 8ce697651..9350f8b9d 100644 --- a/apps/openmw-mp/Cell.cpp +++ b/apps/openmw-mp/Cell.cpp @@ -39,6 +39,13 @@ Cell::TPlayers Cell::getPlayers() const void Cell::sendToLoaded(mwmp::WorldPacket *worldPacket, mwmp::BaseEvent *baseEvent) const { + if (players.empty()) + { + // Remove this once we are sure it can't happen + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "- Attempt to send packet to players in Cell::sendToLoaded when there are no players!\n- Please report to a developer"); + return; + } + std::list plList; for (auto pl : players)