Skip to content

Commit 2c1a181

Browse files
mojoe-playgroundgrokys
authored andcommitted
Handle case when TaskBarList could not be created (#15852)
* Handle case when TaskBarList could not be created * Use HRESULT.S_OK for better clarity
1 parent 068d0c1 commit 2c1a181

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Windows/Avalonia.Win32/Interop/TaskBarList.cs

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ private static unsafe IntPtr Init()
1919
{
2020
int result = CoCreateInstance(in ShellIds.TaskBarList, IntPtr.Zero, 1, in ShellIds.ITaskBarList2, out IntPtr instance);
2121

22+
if (result != (int)HRESULT.S_OK)
23+
{
24+
return IntPtr.Zero;
25+
}
26+
2227
var ptr = (ITaskBarList3VTable**)instance.ToPointer();
2328

2429
s_hrInitDelegate ??= Marshal.GetDelegateForFunctionPointer<HrInit>((*ptr)->HrInit);

0 commit comments

Comments
 (0)