From 5f815874f1ac64bf5b37265efe95098f2d65d6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20de=20Ory?= Date: Sat, 28 Mar 2020 01:39:15 +0100 Subject: [PATCH] Added chroma exception handling --- LedDashboard/RazerChromaController.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/LedDashboard/RazerChromaController.cs b/LedDashboard/RazerChromaController.cs index 0351705..6d81b57 100644 --- a/LedDashboard/RazerChromaController.cs +++ b/LedDashboard/RazerChromaController.cs @@ -21,8 +21,15 @@ public static RazerChromaController Create() private RazerChromaController() { - if (api == null) api = new NativeRazerApi(); - if (keyboardFrame == null) keyboardFrame = new KeyboradFrame(api); + try + { + if (api == null) api = new NativeRazerApi(); + if (keyboardFrame == null) keyboardFrame = new KeyboradFrame(api); + } catch (Exception e) + { + throw new InvalidOperationException("Error initializing Razer Chroma controller. Is Razer Synapse installed?", e); + } + } public void SendData(int ledCount, byte[] colorArray)