Skip to content

Commit

Permalink
fix: Actions on gump crash when Runebook has no entries (modernuo#1964)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkappers authored Sep 27, 2024
1 parent 9d9a522 commit 766b46b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Projects/UOContent/Gumps/RunebookGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ private void AddIndex(ref DynamicGumpBuilder builder)

for (var i = 0; i < 16; ++i)
{
var entry = entries[i];

// Use charge button
builder.AddButton(130 + i / 8 * 160, 65 + i % 8 * 15, 2103, 2104, 2 + i * 6 + 0);

// Description label
if (i < entries.Count)
{
var entry = entries[i];

builder.AddLabelCropped(
145 + i / 8 * 160,
60 + i % 8 * 15,
Expand Down Expand Up @@ -257,7 +257,7 @@ public override void OnResponse(NetState state, in RelayInfo info)

var index = Math.DivRem(buttonID, 6, out var type);

if (index < 0 || index > _book.Entries.Count)
if (index < 0 || index >= _book.Entries.Count)
{
return;
}
Expand Down

0 comments on commit 766b46b

Please sign in to comment.