Skip to content

Commit b4acac5

Browse files
authored
Fix IndexOutOfRangeException (#2717)
1 parent 49e147b commit b4acac5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/linker/Linker/CompilerGeneratedNames.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal static bool IsLambdaMethod (string methodName)
3434
return false;
3535

3636
// Ignore the method ordinal/generation and lambda ordinal/generation.
37-
return methodName[i + 1] == 'b';
37+
return (methodName.Length > i + 1) && methodName[i + 1] == 'b';
3838
}
3939

4040
// Local functions have generated names like "<UserMethod>g__LocalFunction|0_1" where "UserMethod" is the name
@@ -50,7 +50,7 @@ internal static bool IsLocalFunction (string methodName)
5050
return false;
5151

5252
// Ignore the method ordinal/generation and local function ordinal/generation.
53-
return methodName[i + 1] == 'g';
53+
return (methodName.Length > i + 1) && methodName[i + 1] == 'g';
5454
}
5555
}
5656
}

0 commit comments

Comments
 (0)