Skip to content

Commit d12d992

Browse files
Gillibalddanwalmsley
authored andcommitted
Merge pull request #6461 from Gillibald/fixes/OpacityMask
Prevent DeferredRenderer crash when a VisualBrush is used as OpacityMask
1 parent af2685d commit d12d992

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Avalonia.Visuals/Rendering/DeferredRenderer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ void IRenderLoopTask.Render()
279279
/// <inheritdoc/>
280280
Size IVisualBrushRenderer.GetRenderTargetSize(IVisualBrush brush)
281281
{
282-
return (_currentDraw.Item as BrushDrawOperation)?.ChildScenes?[brush.Visual]?.Size ?? Size.Empty;
282+
return (_currentDraw?.Item as BrushDrawOperation)?.ChildScenes?[brush.Visual]?.Size ?? Size.Empty;
283283
}
284284

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

290290
if (childScene != null)
291291
{

0 commit comments

Comments
 (0)