Skip to content

Commit

Permalink
Fix #2149 (#2237)
Browse files Browse the repository at this point in the history
* Fix #2149

* Update MultiNativeContext.cs

* Update MultiNativeContext.cs
  • Loading branch information
Perksey committed Jul 15, 2024
1 parent 8ac952e commit b079b28
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Core/Silk.NET.Core/Contexts/MultiNativeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#nullable enable
using System;
using System.Linq;
using Silk.NET.Core.Loader;

namespace Silk.NET.Core.Contexts
{
Expand All @@ -30,16 +31,13 @@ public MultiNativeContext(params INativeContext?[] contexts)
/// <inheritdoc />
public nint GetProcAddress(string proc, int? slot = default)
{
foreach (var nativeContext in Contexts)
if (!TryGetProcAddress(proc, out var ret, slot))
{
var ret = nativeContext?.GetProcAddress(proc, slot) ?? default;
if (ret != default)
{
return ret;
}
static void Throw(string fn) => throw new SymbolLoadingException(fn);
Throw(proc);
}

return default;
return ret;
}

/// <inheritdoc />
Expand Down

0 comments on commit b079b28

Please sign in to comment.