[chronojump/FS-TFT-Menu] Fix a crash on CairoGraphEncoderSignal doSendingList() g.LineWidth = 1; under certain circumstancies



commit dc0439a04de31bf707b6e13c8c5a0adcf0eed4cc
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue May 3 15:27:32 2022 +0200

    Fix a crash on CairoGraphEncoderSignal doSendingList() g.LineWidth = 1; under certain circumstancies

 src/gui/cairo/encoder.cs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/cairo/encoder.cs b/src/gui/cairo/encoder.cs
index f07df61c0..c9a31dc4c 100644
--- a/src/gui/cairo/encoder.cs
+++ b/src/gui/cairo/encoder.cs
@@ -107,10 +107,16 @@ public class CairoGraphEncoderSignal : CairoXY
                        return graphInited;
 
                //fix an eventual crash on g.LineWidth below
-               if(g == null)
+               if(g == null || ! graphInited)
                        return false;
 
-               g.LineWidth = 1;
+               //this try/catch is an extra precaution
+               try {
+                       g.LineWidth = 1;
+               } catch {
+                       LogB.Information("Catched on CairoGraphEncoderSignal soSendingList() g.LineWidth");
+                       return graphInited;
+               }
                pointsRadius = 1;
 
                //display this milliseconds on screen, when is higher, scroll


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