safer access light

This commit is contained in:
Pankaj Bhojwani 2021-07-29 10:51:13 -07:00
parent 58fd1b219c
commit e7d8fdb154

View file

@ -64,10 +64,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void CursorLight::ChangeLocation(float xCoord, float yCoord)
{
if (CompositionLight())
if (const auto light = CompositionLight())
{
const auto ay = CompositionLight().as<Windows::UI::Composition::SpotLight>();
ay.Offset({ xCoord, yCoord, 100 });
if (const auto cursorLight = light.try_as<Windows::UI::Composition::SpotLight>())
{
cursorLight.Offset({ xCoord, yCoord, 100 });
}
}
else
{