diff --git a/client/NetPacksClient.cpp b/client/NetPacksClient.cpp index dea5b8a55..c2f89316f 100644 --- a/client/NetPacksClient.cpp +++ b/client/NetPacksClient.cpp @@ -95,6 +95,14 @@ void callAllInterfaces(CClient & cl, void (T::*ptr)(Args...), Args2 && ...args) template void callBattleInterfaceIfPresentForBothSides(CClient & cl, void (T::*ptr)(Args...), Args2 && ...args) { + assert(cl.gameState()->curB); + + if (!cl.gameState()->curB) + { + logGlobal->error("Attempt to call battle interface without ongoing battle!"); + return; + } + callOnlyThatBattleInterface(cl, cl.gameState()->curB->sides[0].color, ptr, std::forward(args)...); callOnlyThatBattleInterface(cl, cl.gameState()->curB->sides[1].color, ptr, std::forward(args)...); if(settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool() && LOCPLINT->battleInt)