[chronojump] Fixed a potential crash on CairoGraphEncoderSignal with no data



commit 16a062f1b8224029d74efa83545df2c0a418e617
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Apr 10 12:36:14 2022 +0200

    Fixed a potential crash on CairoGraphEncoderSignal with no data

 src/gui/cairo/encoder.cs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/gui/cairo/encoder.cs b/src/gui/cairo/encoder.cs
index e9fa63b3c..afc58fad2 100644
--- a/src/gui/cairo/encoder.cs
+++ b/src/gui/cairo/encoder.cs
@@ -81,12 +81,14 @@ public class CairoGraphEncoderSignal : CairoXY
                                minY = -100;
                }
 
+               bool graphInited = false;
                if( maxValuesChanged || forceRedraw ||
                                (points_list != null && points_list.Count != points_list_painted) ||
                                (points_list_inertial != null && points_list_inertial.Count != 
points_list_inertial_painted)
                                )
                {
                        initGraph( font, 1, (maxValuesChanged || forceRedraw) );
+                       graphInited = true;
                        points_list_painted = 0;
                        points_list_inertial_painted = 0;
                }
@@ -97,7 +99,7 @@ public class CairoGraphEncoderSignal : CairoXY
 
                if( points_list == null || points_list.Count == 0 ||
                                (isInertial && (points_list_inertial == null || points_list_inertial.Count == 
0)) )
-                       return true;
+                       return graphInited;
 
                //fix an eventual crash on g.LineWidth below
                if(g == null)


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