- added missing range check to section code.

Fixes asserts on some maps in Kama Sutra.
This commit is contained in:
Christoph Oelckers 2020-05-25 19:20:51 +02:00
parent 6444a7535c
commit ea0da8533c

View file

@ -141,6 +141,7 @@ public:
} }
TArrayView<FSection> SectionsForSector(int sindex) TArrayView<FSection> SectionsForSector(int sindex)
{ {
if (numberOfSectionForSectorPtr[sindex] == 0) return TArrayView<FSection>(nullptr);
return sindex < 0 ? TArrayView<FSection>(0) : TArrayView<FSection>(&allSections[firstSectionForSectorPtr[sindex]], numberOfSectionForSectorPtr[sindex]); return sindex < 0 ? TArrayView<FSection>(0) : TArrayView<FSection>(&allSections[firstSectionForSectorPtr[sindex]], numberOfSectionForSectorPtr[sindex]);
} }
int SectionIndex(const FSection *sect) int SectionIndex(const FSection *sect)