Skip to content

Commit

Permalink
Fix null reference execption
Browse files Browse the repository at this point in the history
TODO: I do not like this, far to flaky.
  • Loading branch information
JimBobSquarePants committed Sep 6, 2017
1 parent 1b13599 commit a478aed
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/ImageSharp/Image/Image{TPixel}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ internal Image(Configuration configuration, int width, int height, ImageMetaData
/// <summary>
/// Gets the root frame.
/// </summary>
private IImageFrame<TPixel> RootFrame => this.Frames.RootFrame;
private IImageFrame<TPixel> RootFrame => this.Frames?.RootFrame;

This comment has been minimized.

Copy link
@tocsoft

tocsoft Sep 6, 2017

Member

Frames can't be null its always created in the constructor


/// <inheritdoc/>
Buffer2D<TPixel> IImageFrame<TPixel>.PixelBuffer => this.RootFrame.PixelBuffer;
Expand All @@ -144,15 +144,9 @@ internal Image(Configuration configuration, int width, int height, ImageMetaData
/// <returns>The <see typeparam="TPixel"/> at the specified position.</returns>
public TPixel this[int x, int y]
{
get
{
return this.RootFrame.PixelBuffer[x, y];
}
get => this.RootFrame.PixelBuffer[x, y];

set
{
this.RootFrame.PixelBuffer[x, y] = value;
}
set => this.RootFrame.PixelBuffer[x, y] = value;
}

/// <summary>
Expand Down

0 comments on commit a478aed

Please sign in to comment.