From a28dae28dc5796b186fc9111f0299790e6ca0ce5 Mon Sep 17 00:00:00 2001 From: Bartosz Cichecki Date: Tue, 4 Jun 2024 22:15:55 +0200 Subject: [PATCH] Reported in #1317 --- .../Listeners/DisplayConfigurationListener.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/LenovoLegionToolkit.Lib/Listeners/DisplayConfigurationListener.cs b/LenovoLegionToolkit.Lib/Listeners/DisplayConfigurationListener.cs index 2085408841..84cbd0e4fd 100644 --- a/LenovoLegionToolkit.Lib/Listeners/DisplayConfigurationListener.cs +++ b/LenovoLegionToolkit.Lib/Listeners/DisplayConfigurationListener.cs @@ -58,5 +58,17 @@ private void SystemEvents_DisplaySettingsChanged(object? sender, EventArgs e) Changed?.Invoke(this, new() { HDR = changed ? IsHDROn : null }); } - private static bool? GetHDRStatus() => Displays.Get().FirstOrDefault()?.GetAdvancedColorInfo().AdvancedColorEnabled; + private static bool? GetHDRStatus() + { + try + { + return Displays.Get().FirstOrDefault()?.GetAdvancedColorInfo().AdvancedColorEnabled; + } + catch (Exception ex) + { + if (Log.Instance.IsTraceEnabled) + Log.Instance.Trace($"Failed to get HDR status. Assuming unavailable.", ex); + return null; + } + } }