Skip to content
This repository was archived by the owner on Jul 24, 2025. It is now read-only.

Commit 144c331

Browse files
Fix #1614
1 parent e871083 commit 144c331

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

LenovoLegionToolkit.Lib/Features/HDRFeature.cs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,34 @@ public class HDRFeature : IFeature<HDRState>
1010
{
1111
public Task<bool> IsSupportedAsync()
1212
{
13-
if (Log.Instance.IsTraceEnabled)
14-
Log.Instance.Trace($"Checking HDR support...");
15-
16-
var display = InternalDisplay.Get();
17-
if (display is null)
13+
try
1814
{
1915
if (Log.Instance.IsTraceEnabled)
20-
Log.Instance.Trace($"Built in display not found");
16+
Log.Instance.Trace($"Checking HDR support...");
2117

22-
return Task.FromResult(false);
23-
}
18+
var display = InternalDisplay.Get();
19+
if (display is null)
20+
{
21+
if (Log.Instance.IsTraceEnabled)
22+
Log.Instance.Trace($"Built in display not found");
2423

25-
var isSupported = display.GetAdvancedColorInfo().AdvancedColorSupported;
24+
return Task.FromResult(false);
25+
}
2626

27-
if (Log.Instance.IsTraceEnabled)
28-
Log.Instance.Trace($"HDR support: {isSupported}");
27+
var isSupported = display.GetAdvancedColorInfo().AdvancedColorSupported;
28+
29+
if (Log.Instance.IsTraceEnabled)
30+
Log.Instance.Trace($"HDR support: {isSupported}");
2931

30-
return Task.FromResult(isSupported);
32+
return Task.FromResult(isSupported);
33+
}
34+
catch (Exception ex)
35+
{
36+
if (Log.Instance.IsTraceEnabled)
37+
Log.Instance.Trace($"Failed to check HDR support", ex);
38+
39+
return Task.FromResult(false);
40+
}
3141
}
3242

3343
public Task<bool> IsHdrBlockedAsync()

0 commit comments

Comments
 (0)