Add null check in wxAuiToolBar event handler

This also prevents the AUI_TOOLBAR_BEGIN_DRAG event from
being sent if there is no active toolbar item being dragged.

Closes https://github.com/wxWidgets/wxWidgets/pull/2062
This commit is contained in:
Ian McInerney 2020-09-28 02:33:30 +01:00 committed by Vadim Zeitlin
parent 5358dd7007
commit bf7965a2d7

View File

@ -2839,7 +2839,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
const bool button_pressed = HasCapture();
// start a drag event
if (!m_dragging && button_pressed &&
if (!m_dragging && button_pressed && m_actionItem &&
abs(evt.GetX() - m_actionPos.x) + abs(evt.GetY() - m_actionPos.y) > 5)
{
// TODO: sending this event only makes sense if there is an 'END_DRAG'