From 447070fa8638d958da8e0c55295219c4d027a50d Mon Sep 17 00:00:00 2001 From: Forrest Guice Date: Tue, 27 Aug 2024 20:59:26 -0700 Subject: [PATCH] fix crash fixes crash in sunlight widget (#735) --- .../suntimeswidget/graph/LightGraphView.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/graph/LightGraphView.java b/app/src/main/java/com/forrestguice/suntimeswidget/graph/LightGraphView.java index e6d9132c9..da061ce85 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/graph/LightGraphView.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/graph/LightGraphView.java @@ -777,9 +777,12 @@ protected void drawPoints(Canvas c, Paint p, LightGraphOptions options) if (options.sunPath_show_points && (options.sunPath_show_line || options.sunPath_show_fill)) { float[][] points = createPathPoints(c, options); - double pointSize = Math.sqrt(c.getWidth() * c.getHeight()) / options.sunPath_points_width; - for (float[] point : points) { - drawPoint(point[0], point[1], (int)pointSize, 0, c, p, options.colors.getColor(COLOR_POINT_FILL), options.colors.getColor(COLOR_POINT_STROKE), null); + if (points != null) + { + double pointSize = Math.sqrt(c.getWidth() * c.getHeight()) / options.sunPath_points_width; + for (float[] point : points) { + drawPoint(point[0], point[1], (int)pointSize, 0, c, p, options.colors.getColor(COLOR_POINT_FILL), options.colors.getColor(COLOR_POINT_STROKE), null); + } } } }