]> git.lyx.org Git - lyx.git/commitdiff
Check the validity of an item before querying its tooltip
authorGuillaume Munch <gm@lyx.org>
Sat, 3 Dec 2016 22:35:15 +0000 (23:35 +0100)
committerGuillaume Munch <gm@lyx.org>
Sat, 3 Dec 2016 22:35:15 +0000 (23:35 +0100)
In case data() does not handle invalid items.

src/frontends/qt4/ToolTipFormatter.cpp

index d29012ca9b3edaac2b41d98d150ee1f5ee6c76fc..4594bbc2a9856d4bcf149be43f0570a5f2192f7d 100644 (file)
@@ -52,6 +52,8 @@ bool ToolTipFormatter::eventFilter(QObject * o, QEvent * e)
        // on the screen.
        QPoint pos = static_cast<QHelpEvent *>(e)->pos();
        QModelIndex item = iv->indexAt(pos);
+       if (!item.isValid())
+               return false;
        QVariant data = iv->model()->data(item, Qt::ToolTipRole);
        if (data.isValid() && data.typeName() == toqstr("QString"))
                // Unchanged if empty or already formatted