Qt: Fix NULL pointer dereference on mouse click

The call to model() returns nullptr if executed while file is still
loading. This won't happen if current model index is valid.

Change-Id: I2b5b084f0d2092af2b0e78b58e1e17983e01351d
Reviewed-on: https://code.wireshark.org/review/34597
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Tomasz Moń 2019-09-23 16:31:09 +02:00 committed by Anders Broman
parent 3c245f2f46
commit 0b0bc1441a
1 changed files with 1 additions and 1 deletions

View File

@ -666,7 +666,7 @@ void PacketList::mouseReleaseEvent(QMouseEvent *event) {
void PacketList::mouseMoveEvent (QMouseEvent *event)
{
QModelIndex curIndex = indexAt(event->pos());
if ( event->buttons() & Qt::LeftButton && curIndex == mouse_pressed_at_ )
if ( event->buttons() & Qt::LeftButton && curIndex.isValid() && curIndex == mouse_pressed_at_ )
{
ctx_column_ = curIndex.column();
QMimeData * mimeData = nullptr;