Skip to content

Commit a16a1df

Browse files
authored
halfhp#52 - Added NPE check to Plot.renderOnCanvas (halfhp#59)
1 parent 44c9b62 commit a16a1df

File tree

1 file changed

+5
-1
lines changed
  • androidplot-core/src/main/java/com/androidplot

1 file changed

+5
-1
lines changed

androidplot-core/src/main/java/com/androidplot/Plot.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import android.graphics.*;
2222
import android.os.Build;
2323
import android.os.Looper;
24+
import android.support.annotation.Nullable;
2425
import android.util.AttributeSet;
2526
import android.util.Log;
2627
import android.view.View;
@@ -804,7 +805,10 @@ protected void onDraw(Canvas canvas) {
804805
* "heavy lifting".
805806
* @param canvas
806807
*/
807-
protected synchronized void renderOnCanvas(Canvas canvas) {
808+
protected synchronized void renderOnCanvas(@Nullable Canvas canvas) {
809+
if(canvas == null) {
810+
return;
811+
}
808812
try {
809813
// any series interested in synchronizing with plot should
810814
// implement PlotListener.onBeforeDraw(...) and do a read lock from within its

0 commit comments

Comments
 (0)