Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

为什么直接设置4条线就会报空指针~ #16

Open
alless1 opened this issue Jun 6, 2017 · 1 comment
Open

为什么直接设置4条线就会报空指针~ #16

alless1 opened this issue Jun 6, 2017 · 1 comment

Comments

@alless1
Copy link

alless1 commented Jun 6, 2017

Caused by: java.lang.NullPointerException: Attempt to read from field 'float android.graphics.RectF.left' on a null object reference
at tech.linjiang.suitlines.SuitLines.buildPaintColor(SuitLines.java:814)
at tech.linjiang.suitlines.SuitLines.access$1000(SuitLines.java:61)
at tech.linjiang.suitlines.SuitLines$LineBuilder.build(SuitLines.java:1375)
at tech.linjiang.suitlines.simple.DemoChartActivity.init(DemoChartActivity.java:139)
at tech.linjiang.suitlines.simple.DemoChartActivity.onCreate(DemoChartActivity.java:32)

@bilifo
Copy link

bilifo commented May 27, 2019

这是作者的一个bug,在他源码SuitLines类种
/**
*
* @param color 不能为null
* @return
*/
private LinearGradient buildPaintColor(int[] color) {
int[] bakColor = color;
if (color != null && color.length < 2) {
bakColor = new int[2];
bakColor[0] = color[0];
bakColor[1] = color[0];
}
if(linesArea==null){ //添加该判断
calcAreas();
}
return new LinearGradient(linesArea.left, linesArea.top,
linesArea.left, linesArea.bottom, bakColor, null, Shader.TileMode.CLAMP);
}
即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants