From 5a2cc24190d768b1dba8d8b7d6a0783db3510781 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 24 Feb 2022 00:02:47 +0000 Subject: [PATCH] Fix initialisation of new road stop specs --- src/newgrf.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 7daecd300a..adf027ce1b 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4986,7 +4986,10 @@ static ChangeInfoResult RoadStopChangeInfo(uint id, int numinfo, int prop, const case 0x08: { // Road Stop Class ID RoadStopSpec **spec = &_cur.grffile->roadstops[id + i]; - if (*spec == nullptr) *spec = CallocT(1); + if (*spec == nullptr) { + *spec = CallocT(1); + new (*spec) RoadStopSpec(); + } uint32 classid = buf->ReadDWord(); (*spec)->cls_id = RoadStopClass::Allocate(BSWAP32(classid));