Reputation: 80
According to the [Canvas.drawVertices Javadoc](http://developer.android.com/reference/android/graphics/Canvas.html#drawVertices(android.graphics.Canvas.VertexMode, int, float[], int, float[], int, int[], int, short[], int, int, android.graphics.Paint)) it is valid to pass null
as Paint, if also the texs
parameter is null
.
paint Specifies the shader to use if the texs array is non-null
When calling the drawVertices
method with a null
for Paint, this will cause a Null Pointer Exception.
Upvotes: 0
Views: 506
Reputation: 63955
because internally it calls
nativeDrawVertices(mNativeCanvas, mode.nativeInt, vertexCount, verts,
vertOffset, texs, texOffset, colors, colorOffset,
indices, indexOffset, indexCount, paint.mNativePaint);
and paint.mNativePaint
will cause a NullPointerException if paint is null. The doc forgot to tell you that paint can't be null here :)
Also painting vertices without paint does not seem to be logical since paint defines the line type etc. And the doc does not state paint is optional
.
Upvotes: 1