Small fixes (#910)

* Fix potential index out of bounds

* Fix potential index out of bounds

* Use 'MAXGEOSECTORS' instead of magic constant
This commit is contained in:
Johan Mattsson 2023-04-02 14:10:57 +02:00 committed by GitHub
parent 52ea497b50
commit cebab8f85d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -101,7 +101,7 @@ bool GameInterface::StartGame(FNewGameStartup& gs)
static const uint16_t sounds_d[] = { JIBBED_ACTOR6, BONUS_SPEECH1, DUKE_GETWEAPON2, JIBBED_ACTOR5, JIBBED_ACTOR5 }; static const uint16_t sounds_d[] = { JIBBED_ACTOR6, BONUS_SPEECH1, DUKE_GETWEAPON2, JIBBED_ACTOR5, JIBBED_ACTOR5 };
static const uint16_t sounds_r[] = { 427, 428, 196, 195, 197 }; static const uint16_t sounds_r[] = { 427, 428, 196, 195, 197 };
if (gs.Skill >=0 && gs.Skill <= 5) skillsound = isRR()? sounds_r[gs.Skill] : sounds_d[gs.Skill]; if (gs.Skill >=0 && gs.Skill < 5) skillsound = isRR()? sounds_r[gs.Skill] : sounds_d[gs.Skill];
if (menu_sounds && skillsound >= 0 && SoundEnabled() && !netgame) if (menu_sounds && skillsound >= 0 && SoundEnabled() && !netgame)
{ {

View file

@ -528,7 +528,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
if (!actor->exists()) continue; if (!actor->exists()) continue;
if (actor->GetClass()->TypeName == NAME_RedneckGeometryEffect) if (actor->GetClass()->TypeName == NAME_RedneckGeometryEffect)
{ {
if (geocnt > 64) if (geocnt >= MAXGEOSECTORS)
I_Error("Too many geometry effects"); I_Error("Too many geometry effects");
if (actor->spr.hitag == 0) if (actor->spr.hitag == 0)
{ {