Merge pull request #41 from rive-app/fix_minor_version

Fix minor version reading newer minor version.
This commit is contained in:
Matt Sullivan
2020-12-22 16:30:44 -08:00
committed by GitHub
2 changed files with 11 additions and 5 deletions

View File

@ -153,8 +153,11 @@ class RiveFile {
assert(!artboard.children.contains(artboard),
'artboard should never contain itself as a child');
for (final object in artboard.objects) {
object?.onAdded();
for (final object in artboard.objects.toList(growable:false)) {
if(object == null) {
continue;
}
object.onAdded();
}
artboard.clean();
}
@ -165,7 +168,8 @@ class RiveFile {
void _skipProperty(BinaryReader reader, int propertyKey,
HashMap<int, CoreFieldType> propertyToField) {
var field = propertyToField[propertyKey];
var field =
RiveCoreContext.coreType(propertyKey) ?? propertyToField[propertyKey];
if (field == null) {
throw UnsupportedError('Unsupported property key $propertyKey. '
'A new runtime is likely necessary to play this file.');

View File

@ -18,8 +18,10 @@ class RuntimeArtboard extends Artboard implements CoreContext {
@override
T addObject<T extends Core>(T object) {
object.context = this;
object.id = _objects.length;
if (object != null) {
object.context = this;
object.id = _objects.length;
}
_objects.add(object);
return object;
}