FZ: fix nullptr crash

This commit is contained in:
yuyoyuppe
2020-10-23 18:40:23 +03:00
committed by Andrey Nekrasov
parent e5f2810212
commit 8ca0c35242

View File

@@ -1180,6 +1180,8 @@ bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept
else else
{ {
auto workArea = m_workAreaHandler.GetWorkArea(m_currentDesktopId, monitor); auto workArea = m_workAreaHandler.GetWorkArea(m_currentDesktopId, monitor);
if (workArea)
{
auto zoneSet = workArea->ActiveZoneSet(); auto zoneSet = workArea->ActiveZoneSet();
if (zoneSet) if (zoneSet)
{ {
@@ -1199,6 +1201,7 @@ bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept
} }
} }
} }
}
// Ensure we can get the windowRect, if not, just quit // Ensure we can get the windowRect, if not, just quit
RECT windowRect; RECT windowRect;
@@ -1224,6 +1227,8 @@ bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept
if (currentMonitorRect.top <= currentMonitorRect.bottom) if (currentMonitorRect.top <= currentMonitorRect.bottom)
{ {
auto workArea = m_workAreaHandler.GetWorkArea(m_currentDesktopId, current); auto workArea = m_workAreaHandler.GetWorkArea(m_currentDesktopId, current);
if (workArea)
{
auto zoneSet = workArea->ActiveZoneSet(); auto zoneSet = workArea->ActiveZoneSet();
if (zoneSet) if (zoneSet)
{ {
@@ -1242,6 +1247,7 @@ bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept
} }
} }
} }
}
else else
{ {
return false; return false;
@@ -1353,7 +1359,7 @@ bool FancyZones::ShouldProcessSnapHotkey(DWORD vkCode) noexcept
} }
auto zoneWindow = m_workAreaHandler.GetWorkArea(m_currentDesktopId, monitor); auto zoneWindow = m_workAreaHandler.GetWorkArea(m_currentDesktopId, monitor);
if (zoneWindow->ActiveZoneSet() != nullptr) if (zoneWindow && zoneWindow->ActiveZoneSet() != nullptr)
{ {
if (vkCode == VK_UP || vkCode == VK_DOWN) if (vkCode == VK_UP || vkCode == VK_DOWN)
{ {