Skip to content

Commit 292632f

Browse files
HaarmeesJochemH
and
JochemH
authored
Added null checks to prevent null pointer exception (#62013)
Co-authored-by: JochemH <[email protected]>
1 parent 89e3040 commit 292632f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/coreclr/tools/ILVerify/Program.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private Program(Options options)
9696
string[] includePatterns = options.Include;
9797
if (options.IncludeFile != null)
9898
{
99-
if (options.Include.Length != 0)
99+
if (options.Include != null && options.Include.Length != 0)
100100
WriteLine("[Warning] --include-file takes precedence over --include");
101101
includePatterns = File.ReadAllLines(options.IncludeFile.FullName);
102102
}
@@ -105,7 +105,7 @@ private Program(Options options)
105105
string[] excludePatterns = options.Exclude;
106106
if (options.ExcludeFile != null)
107107
{
108-
if (options.Exclude.Length != 0)
108+
if (options.Exclude != null && options.Exclude.Length != 0)
109109
WriteLine("[Warning] --exclude-file takes precedence over --exclude");
110110
excludePatterns = File.ReadAllLines(options.ExcludeFile.FullName);
111111
}
@@ -114,7 +114,7 @@ private Program(Options options)
114114
string[] ignoreErrorPatterns = options.IgnoreError;
115115
if (options.IgnoreErrorFile != null)
116116
{
117-
if (options.IgnoreError.Length != 0)
117+
if (options.IgnoreError != null && options.IgnoreError.Length != 0)
118118
WriteLine("[Warning] --ignore-error-file takes precedence over --ignore-error");
119119
ignoreErrorPatterns = File.ReadAllLines(options.IgnoreErrorFile.FullName);
120120
}

0 commit comments

Comments
 (0)