mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-01 05:56:41 -05:00
Disallow out-of-bounds puff values
Closes #246 Might as well use the SAV property "Puffs" when loading instead of only when saving.
This commit is contained in:
@@ -48,11 +48,18 @@ private void Setup()
|
||||
dgv.Columns.Add(dgvIndex);
|
||||
dgv.Columns.Add(dgvPuff);
|
||||
|
||||
dgv.Rows.Add(100);
|
||||
for (int i = 0; i < 100; i++)
|
||||
var Puffs = SAV.Puffs;
|
||||
dgv.Rows.Add(Puffs.Length);
|
||||
for (int i = 0; i < Puffs.Length; i++)
|
||||
{
|
||||
dgv.Rows[i].Cells[0].Value = (i + 1).ToString();
|
||||
dgv.Rows[i].Cells[1].Value = pfa[SAV.Data[SAV.Puff + i]];
|
||||
int puffval = Puffs[i];
|
||||
if (puffval >= pfa.Length)
|
||||
{
|
||||
Util.Error($"Invalid Puff Index: {i}", $"Expected < ${pfa.Length}");
|
||||
puffval = 0;
|
||||
}
|
||||
dgv.Rows[i].Cells[1].Value = pfa[puffval];
|
||||
}
|
||||
MT_CNT.Text = SAV.PuffCount.ToString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user