mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-22 01:06:35 +00:00
AnimationEditor - Fix null reference exception when loading treeview
This commit is contained in:
@@ -15,6 +15,10 @@ namespace PckStudio.Extensions
|
||||
{
|
||||
internal static Image CreateAnimationImage(this Animation animation)
|
||||
{
|
||||
if (animation.FrameCount == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var ms = new System.IO.MemoryStream();
|
||||
var generateor = new AnimatedGifCreator(ms, Animation.GameTickInMilliseconds, 0);
|
||||
foreach (var frame in animation.GetInterpolatedFrames())
|
||||
|
||||
@@ -94,6 +94,8 @@ namespace PckStudio.Forms.Editor
|
||||
TextureIcons.Images.AddRange(_animation.GetTextures().ToArray());
|
||||
UpdateTreeView();
|
||||
|
||||
animationPictureBox.Image ??= _animation.CreateAnimationImage();
|
||||
|
||||
if (_animation.FrameCount > 0)
|
||||
{
|
||||
animationPictureBox.Image.SelectActiveFrame(FrameDimension.Page, 0);
|
||||
|
||||
Reference in New Issue
Block a user