Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec351a6

Browse files
authored
Fix NRE in WGL IsExtensionPresent (#2470)
`_extensions` was always null, so this always threw an exception
1 parent1fc3e6b commitec351a6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/OpenGL/Silk.NET.WGL/WGL.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ public bool TryGetExtension<T>(out T ext, nint hdc)
4141

4242
publicoverrideboolIsExtensionPresent(stringextension)=>IsExtensionPresent(extension,GetCurrentDC());
4343

44-
privateConcurrentDictionary<nint,HashSet<string>>_extensions;
44+
privatereadonlyConcurrentDictionary<nint,HashSet<string>>_extensions=new();
4545

4646
[NativeApi(EntryPoint="wglGetExtensionsStringARB")]
4747
privatepartialstringGetExtensionsString(ninthdc);
4848

49-
privatestaticHashSet<string>?_empty;
49+
privatestaticreadonlyHashSet<string>_empty=new();
5050
privatebool_hasGetExtensionsString;
5151

5252
publicboolIsExtensionPresent(stringextension,ninthdc)=>_extensions.GetOrAdd
5353
(
5454
hdc, hdc=>!(_hasGetExtensionsString=
5555
_hasGetExtensionsString||GetProcAddress("wglGetExtensionsStringARB")!=0)
56-
?_empty??=newHashSet<string>()
57-
:newHashSet<string>(GetExtensionsString(hdc).Split(' '))
56+
?_empty
57+
:newHashSet<string>(GetExtensionsString(hdc).Split(' '))
5858
)
5959
.Contains(extension.StartsWith("WGL_")?extension:$"WGL_{extension}");
6060
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp