diff options
author | Sven Boemer <sbomer@gmail.com> | 2022-04-01 22:19:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-01 22:19:04 +0300 |
commit | b4acac52aa8108252bfdd411f4186ebfbadd2352 (patch) | |
tree | f5897df583c96fc1c3aabbfdb27104dde0e5c2d5 | |
parent | 49e147b83f83cd937faa96da4d3f221e9928bbb6 (diff) |
Fix IndexOutOfRangeException (#2717)
-rw-r--r-- | src/linker/Linker/CompilerGeneratedNames.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/linker/Linker/CompilerGeneratedNames.cs b/src/linker/Linker/CompilerGeneratedNames.cs index 294ee5047..34a8fcd3c 100644 --- a/src/linker/Linker/CompilerGeneratedNames.cs +++ b/src/linker/Linker/CompilerGeneratedNames.cs @@ -34,7 +34,7 @@ namespace Mono.Linker return false; // Ignore the method ordinal/generation and lambda ordinal/generation. - return methodName[i + 1] == 'b'; + return (methodName.Length > i + 1) && methodName[i + 1] == 'b'; } // Local functions have generated names like "<UserMethod>g__LocalFunction|0_1" where "UserMethod" is the name @@ -50,7 +50,7 @@ namespace Mono.Linker return false; // Ignore the method ordinal/generation and local function ordinal/generation. - return methodName[i + 1] == 'g'; + return (methodName.Length > i + 1) && methodName[i + 1] == 'g'; } } } |