diff --git a/.github/release-notes.txt b/.github/release-notes.txt
index 550a9df..cd49da5 100644
--- a/.github/release-notes.txt
+++ b/.github/release-notes.txt
@@ -45,4 +45,7 @@
- `AsepriteCel` properties were made public (thanks @SephDB)
- `AnimatedSprite` now supports setting frame both on initial play and during playback.
+## 5.1.1
+- Resolved issue where using Linked Cels can cause an out of bounds exception.
+
\ No newline at end of file
diff --git a/.nuget/README.md b/.nuget/README.md
index 731295d..a1bffa3 100644
--- a/.nuget/README.md
+++ b/.nuget/README.md
@@ -3,7 +3,7 @@
A Cross Platform C# Library That Adds Support For Aseprite Files in MonoGame Projects.
[![build-and-test](https://github.com/AristurtleDev/monogame-aseprite/actions/workflows/buildandtest.yml/badge.svg)](https://github.com/AristurtleDev/monogame-aseprite/actions/workflows/buildandtest.yml)
-[![Nuget 5.1.0](https://img.shields.io/nuget/v/MonoGame.Aseprite?color=blue&style=flat-square)](https://www.nuget.org/packages/MonoGame.Aseprite/5.1.0)
+[![Nuget 5.1.1](https://img.shields.io/nuget/v/MonoGame.Aseprite?color=blue&style=flat-square)](https://www.nuget.org/packages/MonoGame.Aseprite/5.1.1)
[![License: MIT](https://img.shields.io/badge/📃%20license-MIT-blue?style=flat)](LICENSE)
[![Twitter](https://img.shields.io/badge/%20-Share%20On%20Twitter-555?style=flat&logo=twitter)](https://twitter.com/intent/tweet?text=MonoGame.Aseprite%20by%20%40aristurtledev%0A%0AA%20cross-platform%20C%23%20library%20that%20adds%20support%20for%20Aseprite%20files%20in%20MonoGame%20projects.%20https%3A%2F%2Fgithub.com%2FAristurtleDev%2Fmonogame-aseprite%0A%0A%23monogame%20%23aseprite%20%23dotnet%20%23csharp%20%23oss%0A)
diff --git a/README.md b/README.md
index 2386441..86a7d9c 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
A Cross Platform C# Library That Adds Support For Aseprite Files in MonoGame Projects.
[![build-and-test](https://github.com/AristurtleDev/monogame-aseprite/actions/workflows/buildandtest.yml/badge.svg)](https://github.com/AristurtleDev/monogame-aseprite/actions/workflows/buildandtest.yml)
-[![Nuget 5.1.0](https://img.shields.io/nuget/v/MonoGame.Aseprite?color=blue&style=flat-square)](https://www.nuget.org/packages/MonoGame.Aseprite/5.1.0)
+[![Nuget 5.1.1](https://img.shields.io/nuget/v/MonoGame.Aseprite?color=blue&style=flat-square)](https://www.nuget.org/packages/MonoGame.Aseprite/5.1.1)
[![License: MIT](https://img.shields.io/badge/📃%20license-MIT-blue?style=flat)](LICENSE)
[![Twitter](https://img.shields.io/badge/%20-Share%20On%20Twitter-555?style=flat&logo=twitter)](https://twitter.com/intent/tweet?text=MonoGame.Aseprite%20by%20%40aristurtledev%0A%0AA%20cross-platform%20C%23%20library%20that%20adds%20support%20for%20Aseprite%20files%20in%20MonoGame%20projects.%20https%3A%2F%2Fgithub.com%2FAristurtleDev%2Fmonogame-aseprite%0A%0A%23monogame%20%23aseprite%20%23dotnet%20%23csharp%20%23oss%0A)
diff --git a/source/MonoGame.Aseprite.Content.Pipeline/MonoGame.Aseprite.Content.Pipeline.csproj b/source/MonoGame.Aseprite.Content.Pipeline/MonoGame.Aseprite.Content.Pipeline.csproj
index 201c36e..edaa404 100644
--- a/source/MonoGame.Aseprite.Content.Pipeline/MonoGame.Aseprite.Content.Pipeline.csproj
+++ b/source/MonoGame.Aseprite.Content.Pipeline/MonoGame.Aseprite.Content.Pipeline.csproj
@@ -4,7 +4,7 @@
enable
enable
False
- 5.1.0
+ 5.1.1
@@ -21,9 +21,9 @@
MonoGame.Aseprite.Content.Pipeline
- 5.1.0
- 5.1.0
- 5.1.0
+ 5.1.1
+ 5.1.1
+ 5.1.1
Christopher Whitley
Aristurtle
MIT
@@ -38,10 +38,9 @@
MonoGame;Aseprite;import;processes;read;write;sprite;animation;tileset;tilemap;spritesheet;pipeline;mgcb
- Version 5.1.0
+ Version 5.1.1
The following changes were implemented:
- - `AsepriteCel` properties were made public (thanks @SephDB)
- - `AnimatedSprite` now supports setting frame both on initial play and during playback.
+ - Resolved issue where using Linked Cels can cause an out of bounds exception.
MonoGame.Aseprite.Content.Pipeline is a cross-platform C# library that adds an extension to the MonoGame
diff --git a/source/MonoGame.Aseprite.Shared/AsepriteTypes/AsepriteFileBuilder.cs b/source/MonoGame.Aseprite.Shared/AsepriteTypes/AsepriteFileBuilder.cs
index c2ba795..4aba891 100644
--- a/source/MonoGame.Aseprite.Shared/AsepriteTypes/AsepriteFileBuilder.cs
+++ b/source/MonoGame.Aseprite.Shared/AsepriteTypes/AsepriteFileBuilder.cs
@@ -101,7 +101,10 @@ internal void AddRawImageCel(short x, short y, ushort width, ushort height, usho
internal void AddLinkedCel(ushort frameIndex)
{
AsepriteFrame frame = _frames[frameIndex];
- AsepriteCel linkedCel = frame.Cels[_nextFrameCels.Count];
+ // If the first cel is a linked cel, then we haven't added cels yet
+ // so the " - 1" will result in -1. So we only do so when the count is
+ // greater than 0
+ AsepriteCel linkedCel = frame.Cels[_nextFrameCels.Count > 0 ? _nextFrameCels.Count - 1 : 0];
_nextFrameCels.Add(linkedCel);
}
diff --git a/source/MonoGame.Aseprite/MonoGame.Aseprite.csproj b/source/MonoGame.Aseprite/MonoGame.Aseprite.csproj
index b0309d2..05b4177 100644
--- a/source/MonoGame.Aseprite/MonoGame.Aseprite.csproj
+++ b/source/MonoGame.Aseprite/MonoGame.Aseprite.csproj
@@ -4,7 +4,7 @@
enable
enable
False
- 5.1.0
+ 5.1.1
@@ -29,10 +29,9 @@
README.md
- Version 5.1.0
+ Version 5.1.1
The following changes were implemented:
- - `AsepriteCel` properties were made public (thanks @SephDB)
- - `AnimatedSprite` now supports setting frame both on initial play and during playback.
+ - Resolved issue where using Linked Cels can cause an out of bounds exception.
MonoGame.Aseprite is a cross-platofrm C# library that adds support to MonoGame projects for