Skip to content

Commit

Permalink
safety check on animation ID when editting SpriteFacing
Browse files Browse the repository at this point in the history
  • Loading branch information
saint11 committed Dec 23, 2024
1 parent 3618179 commit e561f6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ protected override bool DrawAllMembersWithTable(ref object target)
int slices = sprite.FacingInfo.Length;
ImGui.Text("Suffix:");
ImGui.SameLine();
fileChanged |= ImGui.InputInt("##slices", ref slices);
if (ImGui.InputInt("##slices", ref slices))
{
fileChanged = true;

}

if (sprite.FacingInfo.Length > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Murder/Services/RenderServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static FrameInfo DrawSprite(
float sort,
float currentTime)
{
if (!asset.Animations.TryGetValue(animationId, out var animation))
if (animationId == null || !asset.Animations.TryGetValue(animationId, out var animation))
{
GameLogger.Log($"Couldn't find animation {animationId}.");
return FrameInfo.Fail;
Expand Down

0 comments on commit e561f6e

Please sign in to comment.