Skip to content

Commit

Permalink
Merge pull request #6461 from Gillibald/fixes/OpacityMask
Browse files Browse the repository at this point in the history
Prevent DeferredRenderer crash when a VisualBrush is used as OpacityMask
  • Loading branch information
Gillibald authored Oct 4, 2021
2 parents 05cdef7 + 0be20ee commit 642b45f
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 642b45f

Please sign in to comment.