Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Clarify SpriteGroupComponent.updateSprite assertion #3317

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ class SpriteGroupComponent<T> extends PositionComponent

/// Updates the sprite for the given key.
void updateSprite(T key, Sprite sprite) {
assert(_sprites != null, 'Sprites map is not yet initialized');
assert(
_sprites != null,
'This call can only be made after the sprites map has been initialized, '
'which should be done in either the constructor or in onLoad.',
);
_sprites?[key] = sprite;
_resizeToSprite();
}
Expand Down