Skip to content

Commit

Permalink
AnimateTimeline: fix crash when Sprite is cast as Shape
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Aug 11, 2023
1 parent d5c5cd0 commit 16d1c9c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/swf/exporters/animate/AnimateTimeline.hx
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,17 @@ class AnimateTimeline extends Timeline
__sprite.graphics.clear();
if (currentInstances.length > 0)
{
var shape:Shape = cast currentInstances[0].displayObject;
__sprite.graphics.copyFrom(shape.graphics);
var displayObject = currentInstances[0].displayObject;
if (#if (haxe_ver >= 4.2) Std.isOfType #else Std.is #end (displayObject, Shape))
{
var shape:Shape = cast displayObject;
__sprite.graphics.copyFrom(shape.graphics);
}
else
{
var sprite:Sprite = cast displayObject;
__sprite.graphics.copyFrom(sprite.graphics);
}
}
}
else
Expand Down

0 comments on commit 16d1c9c

Please sign in to comment.