Animated: Early detection of division by zero in AnimatedDivision
Summary:
Same as D20969087 (be78673755
) but a bit more sophisticated.
We currently see a lot of errors happens because of division by zero in AnimatedDivision module. We already have a check for that in the module but it happens during the animation tick where the context of execution is already lost and it's hard to find why exactly it happens.
Adding an additional check to the constructor should trigger an error right inside render function which should make the error actionable.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: fkgozali
Differential Revision: D23908993
fbshipit-source-id: d21be9a72ec04fe4ff0740777d9ff49cf1bcde73
This commit is contained in:
Родитель
e599d6c5d3
Коммит
27378b7f10
|
@ -24,7 +24,7 @@ class AnimatedDivision extends AnimatedWithChildren {
|
|||
|
||||
constructor(a: AnimatedNode | number, b: AnimatedNode | number) {
|
||||
super();
|
||||
if (b === 0) {
|
||||
if (b === 0 || (b instanceof AnimatedNode && b.__getValue() === 0)) {
|
||||
console.error('Detected potential division by zero in AnimatedDivision');
|
||||
}
|
||||
this._a = typeof a === 'number' ? new AnimatedValue(a) : a;
|
||||
|
|
Загрузка…
Ссылка в новой задаче