Skip to content

Commit 2dd6e2d

Browse files
committed
Add null-forgiving operator to name in TarExtractor
Added the null-forgiving operator (`!`) to the `name` variable in the `while` loop condition to suppress potential null reference warnings. `name` is expected to be non-null at this point in the code becauses of the previous IsNullorEmpty check - however that isn't tagged on netstandard2.0.
1 parent 01357d3 commit 2dd6e2d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

RecursiveExtractor/Extractors/TarExtractor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public async IAsyncEnumerable<FileEntry> ExtractAsync(FileEntry fileEntry, Extra
7070
continue;
7171
}
7272
// Remove leading ./
73-
while (name.StartsWith($".{Path.DirectorySeparatorChar}"))
73+
while (name!.StartsWith($".{Path.DirectorySeparatorChar}"))
7474
{
7575
name = name[2..];
7676
}
@@ -140,7 +140,7 @@ public IEnumerable<FileEntry> Extract(FileEntry fileEntry, ExtractorOptions opti
140140
continue;
141141
}
142142
// Remove leading ./
143-
while (name.StartsWith($".{Path.DirectorySeparatorChar}"))
143+
while (name!.StartsWith($".{Path.DirectorySeparatorChar}"))
144144
{
145145
name = name[2..];
146146
}

0 commit comments

Comments
 (0)