Skip to content

Commit

Permalink
fixed crash in Win32::Taskbar class when internal ITaskbarList3 COM o…
Browse files Browse the repository at this point in the history
…bject couldn't be accessed
  • Loading branch information
vividos committed Mar 21, 2020
1 parent b68d773 commit 5dcdb1b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/ulib/win32/Win7Taskbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ void TaskbarProgressBar::SetState(TaskbarProgressBarState state)
state == TBPF_ERROR ||
state == TBPF_PAUSED);

m_impl->m_taskBarList->SetProgressState(
m_impl->m_hwnd,
static_cast<TBPFLAG>(state));
if (m_impl != nullptr && m_impl->m_taskBarList != nullptr)
{
m_impl->m_taskBarList->SetProgressState(
m_impl->m_hwnd,
static_cast<TBPFLAG>(state));
}
}

void TaskbarProgressBar::SetPos(UINT currentPos, UINT maxPos)
{
m_impl->m_taskBarList->SetProgressValue(m_impl->m_hwnd, currentPos, maxPos);
if (m_impl != nullptr && m_impl->m_taskBarList != nullptr)
{
m_impl->m_taskBarList->SetProgressValue(m_impl->m_hwnd, currentPos, maxPos);
}
}

Taskbar::Taskbar(HWND hwnd)
Expand All @@ -54,5 +60,5 @@ Taskbar::Taskbar(HWND hwnd)

bool Taskbar::IsAvailable() const
{
return m_impl->m_taskBarList != nullptr;
return m_impl != nullptr && m_impl->m_taskBarList != nullptr;
}

0 comments on commit 5dcdb1b

Please sign in to comment.