From 7437fac7406d102bc7fa9f6836ec7d54a1b4eedc Mon Sep 17 00:00:00 2001 From: tzim Date: Fri, 5 Oct 2018 00:35:36 +0200 Subject: [PATCH] Ajouts verifs diverses --- DMX-2.0/Main.cs | 2 +- DMX-2.0/SequenceurOSC.cs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/DMX-2.0/Main.cs b/DMX-2.0/Main.cs index 6a82a77..dbf6540 100644 --- a/DMX-2.0/Main.cs +++ b/DMX-2.0/Main.cs @@ -88,7 +88,7 @@ namespace DMX2 if (openfile != null) win.OpenFile (openfile); - + // Gestion des erreurs non traitées dans l'interface GLib.ExceptionManager.UnhandledException += HandleUnhandledException; diff --git a/DMX-2.0/SequenceurOSC.cs b/DMX-2.0/SequenceurOSC.cs index 69e9f35..c781214 100644 --- a/DMX-2.0/SequenceurOSC.cs +++ b/DMX-2.0/SequenceurOSC.cs @@ -302,17 +302,18 @@ namespace DMX2 Console.WriteLine(enCours.Commande); + if (enCours.Commande == null) return; + if (enCours.Commande.Length == 0) return; + if (iPEndPoint == null) return; + string[] data = enCours.Commande.Split(' '); - - int di; - float df; - + OSCMessage message = new OSCMessage(data[0]); for (int i = 1; i < data.Length; i++) { - if (int.TryParse(data[i], out di)) + if (int.TryParse(data[i], out int di)) message.AddInt(di); - else if (float.TryParse(data[i], out df)) + else if (float.TryParse(data[i], out float df)) message.AddFloat(df); else message.AddString(data[i]); }