mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 15:14:18 +00:00
Fix null handling in setMatrix
This commit is contained in:
@@ -60,7 +60,7 @@ class ImageShadowNode extends RenderableShadowNode {
|
||||
0, 1, 0,
|
||||
0, 0, 1
|
||||
};
|
||||
private Matrix mMatrix = new Matrix();
|
||||
private Matrix mMatrix = null;
|
||||
|
||||
@ReactProp(name = "x")
|
||||
public void setX(String x) {
|
||||
@@ -123,6 +123,9 @@ class ImageShadowNode extends RenderableShadowNode {
|
||||
if (matrixArray != null) {
|
||||
int matrixSize = PropHelper.toMatrixData(matrixArray, sRawMatrix, mScale);
|
||||
if (matrixSize == 6) {
|
||||
if (mMatrix == null) {
|
||||
mMatrix = new Matrix();
|
||||
}
|
||||
mMatrix.setValues(sRawMatrix);
|
||||
} else if (matrixSize != -1) {
|
||||
FLog.w(ReactConstants.TAG, "RNSVG: Transform matrices must be of size 6");
|
||||
|
||||
@@ -37,7 +37,7 @@ class LinearGradientShadowNode extends DefinitionShadowNode {
|
||||
0, 1, 0,
|
||||
0, 0, 1
|
||||
};
|
||||
private Matrix mMatrix = new Matrix();
|
||||
private Matrix mMatrix = null;
|
||||
|
||||
@ReactProp(name = "x1")
|
||||
public void setX1(String x1) {
|
||||
@@ -87,6 +87,9 @@ class LinearGradientShadowNode extends DefinitionShadowNode {
|
||||
if (matrixArray != null) {
|
||||
int matrixSize = PropHelper.toMatrixData(matrixArray, sRawMatrix, mScale);
|
||||
if (matrixSize == 6) {
|
||||
if (mMatrix == null) {
|
||||
mMatrix = new Matrix();
|
||||
}
|
||||
mMatrix.setValues(sRawMatrix);
|
||||
} else if (matrixSize != -1) {
|
||||
FLog.w(ReactConstants.TAG, "RNSVG: Transform matrices must be of size 6");
|
||||
|
||||
@@ -38,7 +38,7 @@ class RadialGradientShadowNode extends DefinitionShadowNode {
|
||||
0, 1, 0,
|
||||
0, 0, 1
|
||||
};
|
||||
private Matrix mMatrix = new Matrix();
|
||||
private Matrix mMatrix = null;
|
||||
|
||||
@ReactProp(name = "fx")
|
||||
public void setFx(String fx) {
|
||||
@@ -100,6 +100,9 @@ class RadialGradientShadowNode extends DefinitionShadowNode {
|
||||
if (matrixArray != null) {
|
||||
int matrixSize = PropHelper.toMatrixData(matrixArray, sRawMatrix, mScale);
|
||||
if (matrixSize == 6) {
|
||||
if (mMatrix == null) {
|
||||
mMatrix = new Matrix();
|
||||
}
|
||||
mMatrix.setValues(sRawMatrix);
|
||||
} else if (matrixSize != -1) {
|
||||
FLog.w(ReactConstants.TAG, "RNSVG: Transform matrices must be of size 6");
|
||||
|
||||
@@ -219,6 +219,9 @@ abstract class VirtualNode extends LayoutShadowNode {
|
||||
if (matrixArray != null) {
|
||||
int matrixSize = PropHelper.toMatrixData(matrixArray, sRawMatrix, mScale);
|
||||
if (matrixSize == 6) {
|
||||
if (mMatrix == null) {
|
||||
mMatrix = new Matrix();
|
||||
}
|
||||
mMatrix.setValues(sRawMatrix);
|
||||
} else if (matrixSize != -1) {
|
||||
FLog.w(ReactConstants.TAG, "RNSVG: Transform matrices must be of size 6");
|
||||
|
||||
Reference in New Issue
Block a user