mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
fix(animations): check if target is present before removing its animation (#4586)
In Angular, if the NativeScriptAnimationModule is imported in another NgModule more than once (which shouldn't be done), the renderer is instantiated twice. This causes animation with empty targets to be created. If such animation is removed, the app will crash. Additional check if the target is present will prevent this.
This commit is contained in:

committed by
Alexander Vakrilov

parent
1f9a64e908
commit
4bd3a94873
@ -192,14 +192,20 @@ export class Animation extends AnimationBase {
|
||||
this._propertyUpdateCallbacks.forEach(v => v());
|
||||
this._disableHardwareAcceleration();
|
||||
this._resolveAnimationFinishedPromise();
|
||||
this._target._removeAnimation(this);
|
||||
|
||||
if (this._target) {
|
||||
this._target._removeAnimation(this);
|
||||
}
|
||||
}
|
||||
|
||||
private _onAndroidAnimationCancel() { // tslint:disable-line
|
||||
this._propertyResetCallbacks.forEach(v => v());
|
||||
this._disableHardwareAcceleration();
|
||||
this._rejectAnimationFinishedPromise();
|
||||
this._target._removeAnimation(this);
|
||||
|
||||
if (this._target) {
|
||||
this._target._removeAnimation(this);
|
||||
}
|
||||
}
|
||||
|
||||
private _createAnimators(propertyAnimation: PropertyAnimation): void {
|
||||
|
Reference in New Issue
Block a user