X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameTick.cpp;h=efd06e752eb7fb921b95e493ebd81da29f5b5149;hb=3e35667d102382398aa701a883f1fd951eed0ee3;hp=a8a5cfb67bf8e4ce50da4ba00c8c4b82ff5f25cf;hpb=49aefa6106fcaeca415161b83239be4152d79270;p=lugaru.git diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index a8a5cfb..efd06e7 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -992,6 +992,10 @@ void Game::Loadlevel(const std::string& name) if (mapvers >= 7) { int numhotspots; funpackf(tfile, "Bi", &numhotspots); + if (numhotspots < 0) { + cerr << "Map " << name << " have an invalid number of hotspots" << endl; + numhotspots = 0; + } Hotspot::hotspots.resize(numhotspots); for (int i = 0; i < Hotspot::hotspots.size(); i++) { funpackf(tfile, "Bi Bf Bf Bf Bf", &Hotspot::hotspots[i].type, &Hotspot::hotspots[i].size, &Hotspot::hotspots[i].position.x, &Hotspot::hotspots[i].position.y, &Hotspot::hotspots[i].position.z);