From 8078db5fd56643cf6f34937eb2765a9a1bc7a6d9 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Tue, 13 Apr 2021 14:17:43 -0700 Subject: [PATCH] Only update render appearance settings if there's a renderer (#9798) I ran into this crash when I just opened a new tab. Fixes MSFT-32485023 (cherry picked from commit dab52c46a25eba20607b98d16fb0c786e66407c3) --- src/cascadia/TerminalControl/TermControl.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index da4b256e70c..a0e56a650de 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -481,11 +481,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation // Update the terminal core with its new Core settings _terminal->UpdateAppearance(newAppearance); - // Update DxEngine settings under the lock - _renderEngine->SetSelectionBackground(til::color{ newAppearance.SelectionBackground() }); - _renderEngine->SetRetroTerminalEffect(newAppearance.RetroTerminalEffect()); - _renderEngine->SetPixelShaderPath(newAppearance.PixelShaderPath()); - _renderer->TriggerRedrawAll(); + if (_renderEngine) + { + // Update DxEngine settings under the lock + _renderEngine->SetSelectionBackground(til::color{ newAppearance.SelectionBackground() }); + _renderEngine->SetRetroTerminalEffect(newAppearance.RetroTerminalEffect()); + _renderEngine->SetPixelShaderPath(newAppearance.PixelShaderPath()); + _renderer->TriggerRedrawAll(); + } } // Method Description: