Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix null ref for null Stream input in Icon.Save #63369

Merged
merged 1 commit into from
Jan 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public void Save(Stream outputStream)
{
if (_iconData != null)
{
ArgumentNullException.ThrowIfNull(outputStream);
outputStream.Write(_iconData, 0, _iconData.Length);
}
else
Expand All @@ -32,9 +33,7 @@ public void Save(Stream outputStream)
{
try
{
if (outputStream == null)
throw new ArgumentNullException(nameof(outputStream));

ArgumentNullException.ThrowIfNull(outputStream);
picture.SaveAsFile(new GPStream(outputStream, makeSeekable: false), -1, out int temp);
}
finally
Expand Down