@@ -179,7 +179,7 @@ namespace Avalonia.Controls
double ILayoutRoot.LayoutScaling => PlatformImpl?.Scaling ?? 1;
/// <inheritdoc/>
- double IRenderRoot.RenderScaling => PlatformImpl.Scaling;
+ double IRenderRoot.RenderScaling => PlatformImpl?.Scaling ?? 1;
IStyleHost IStyleHost.StylingParent
{
@@ -327,7 +327,7 @@ namespace Avalonia.Rendering
catch (RenderTargetCorruptedException ex)
Logging.Logger.Information("Renderer", this, "Render target was corrupted. Exception: {0}", ex);
- _renderTarget.Dispose();
+ _renderTarget?.Dispose();
_renderTarget = null;
}
@@ -46,7 +46,7 @@ namespace Avalonia.Rendering.SceneGraph
protected Pen ToImmutable(Pen pen)
var brush = pen?.Brush != null ? ToImmutable(pen.Brush) : null;
- return ReferenceEquals(pen?.Brush, brush) ?
+ return pen == null || ReferenceEquals(pen?.Brush, brush) ?
pen :
new Pen(
brush,