[chronojump] ForceSensor capture with path, fixed potential crash since last commits



commit 3dc0d6b44166f25b34bc516df6f4a6775fc0f2f5
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 21 16:16:20 2021 +0200

    ForceSensor capture with path, fixed potential crash since last commits

 src/gui/app1/forceSensor.cs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/gui/app1/forceSensor.cs b/src/gui/app1/forceSensor.cs
index 15ee27d09..c20adfa38 100644
--- a/src/gui/app1/forceSensor.cs
+++ b/src/gui/app1/forceSensor.cs
@@ -1835,7 +1835,10 @@ LogB.Information(" fs R ");
                        force_capture_pixmap.GetSize(out width, out height);
                        Gdk.Image image = force_capture_pixmap.GetImage(0, 0, width, height);
 
-                       for(int i = paintPoints.Length -1 -toDraw; i < paintPoints.Length; i ++)
+                       int start = paintPoints.Length -1 -toDraw;
+                       if(start < 0)
+                               start = 0;
+                       for(int i = start; i < paintPoints.Length; i ++)
                        {
                                uint px = image.GetPixel(paintPoints[i].X, paintPoints[i].Y);
                                if(UtilGtk.IdentifyPixelColorIsInPath(px))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]