Skip to content

Commit

Permalink
Prevent the renderer from crashing when a VisualBrush is used as a Op…
Browse files Browse the repository at this point in the history
…acityMask
  • Loading branch information
Gillibald committed Oct 1, 2021
1 parent 01d30d7 commit 4077e69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Avalonia.Visuals/Rendering/DeferredRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,13 @@ void IRenderLoopTask.Render()
/// <inheritdoc/>
Size IVisualBrushRenderer.GetRenderTargetSize(IVisualBrush brush)
{
return (_currentDraw.Item as BrushDrawOperation)?.ChildScenes?[brush.Visual]?.Size ?? Size.Empty;
return (_currentDraw?.Item as BrushDrawOperation)?.ChildScenes?[brush.Visual]?.Size ?? Size.Empty;
}

/// <inheritdoc/>
void IVisualBrushRenderer.RenderVisualBrush(IDrawingContextImpl context, IVisualBrush brush)
{
var childScene = (_currentDraw.Item as BrushDrawOperation)?.ChildScenes?[brush.Visual];
var childScene = (_currentDraw?.Item as BrushDrawOperation)?.ChildScenes?[brush.Visual];

if (childScene != null)
{
Expand Down

0 comments on commit 4077e69

Please sign in to comment.