From f2b3c4d8ecc655e0e0a1c9c9c628a10375ac3b3f Mon Sep 17 00:00:00 2001 From: wraitii Date: Fri, 22 Jan 2021 08:14:27 +0000 Subject: [PATCH] Fix a crash in WaterRenderer.cpp This fixes a rare crash at map generation. The water renderer could be left in an invalid state when exiting a game, and would then crash on the next map generation in some cases. Tested by: Stan Differential Revision: https://code.wildfiregames.com/D3447 This was SVN commit r24759. --- source/simulation2/components/CCmpWaterManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/simulation2/components/CCmpWaterManager.cpp b/source/simulation2/components/CCmpWaterManager.cpp index e3a95ce403..c43a95a522 100644 --- a/source/simulation2/components/CCmpWaterManager.cpp +++ b/source/simulation2/components/CCmpWaterManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -55,6 +55,9 @@ public: virtual void Deinit() { + // Clear the map size & data. + if (CRenderer::IsInitialised()) + g_Renderer.GetWaterManager()->SetMapSize(0); } virtual void Serialize(ISerializer& serialize)