mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
LibGUI: Return early if drag_data_type is null (#3919)
If the user tries to drag an item with a null drag data type from an AbstractView, return from the mouse event early.
This commit is contained in:
parent
5ed7ca3627
commit
9efcb5d290
1 changed files with 4 additions and 1 deletions
|
@ -265,6 +265,10 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
||||||
auto hovered_index = index_at_event_position(event.position());
|
auto hovered_index = index_at_event_position(event.position());
|
||||||
set_hovered_index(hovered_index);
|
set_hovered_index(hovered_index);
|
||||||
|
|
||||||
|
auto data_type = m_model->drag_data_type();
|
||||||
|
if (data_type.is_null())
|
||||||
|
return ScrollableWidget::mousemove_event(event);
|
||||||
|
|
||||||
if (!m_might_drag)
|
if (!m_might_drag)
|
||||||
return ScrollableWidget::mousemove_event(event);
|
return ScrollableWidget::mousemove_event(event);
|
||||||
|
|
||||||
|
@ -280,7 +284,6 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
||||||
if (distance_travelled_squared <= drag_distance_threshold)
|
if (distance_travelled_squared <= drag_distance_threshold)
|
||||||
return ScrollableWidget::mousemove_event(event);
|
return ScrollableWidget::mousemove_event(event);
|
||||||
|
|
||||||
auto data_type = m_model->drag_data_type();
|
|
||||||
ASSERT(!data_type.is_null());
|
ASSERT(!data_type.is_null());
|
||||||
|
|
||||||
dbg() << "Initiate drag!";
|
dbg() << "Initiate drag!";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue