better security for render method

This commit is contained in:
Luan Nico
2017-12-25 22:48:04 -02:00
parent 6282e9ee46
commit 15f83da616
3 changed files with 9 additions and 3 deletions

View File

@ -33,8 +33,10 @@ class AnimationComponent extends PositionComponent {
@override
void render(Canvas canvas) {
prepareCanvas(canvas);
animation.getSprite().render(canvas, width, height);
if (animation.loaded() && x != null && y != null) {
prepareCanvas(canvas);
animation.getSprite().render(canvas, width, height);
}
}
@override