mirror of https://github.com/AxioDL/metaforce.git
DNAMP1/CTweakPlayerGun: Prevent array overrun cases
These arrays are both 5 elements in size. Accessing them at index 5 would be out of bounds.
This commit is contained in:
parent
fea7984f71
commit
66ce2774d5
|
@ -89,14 +89,16 @@ struct CTweakPlayerGun final : ITweakPlayerGun {
|
|||
}
|
||||
|
||||
const SWeaponInfo& GetBeamInfo(atInt32 beam) const override {
|
||||
if (beam < 0 || beam > 5)
|
||||
if (beam < 0 || beam >= 5) {
|
||||
return xa8_beams[0];
|
||||
}
|
||||
return xa8_beams[beam];
|
||||
}
|
||||
|
||||
const SComboShotParam& GetComboShotInfo(atInt32 beam) const override {
|
||||
if (beam < 0 || beam > 5)
|
||||
if (beam < 0 || beam >= 5) {
|
||||
return x1f0_combos[0];
|
||||
}
|
||||
return x1f0_combos[beam];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue