Handle None values in lessThan

This commit is contained in:
Florian Bruhin 2018-10-03 15:15:25 +02:00
parent 1cedfc5470
commit 9ca6da485c
2 changed files with 9 additions and 1 deletions

View File

@ -100,6 +100,7 @@ Fixed
- Crash when trying to load an empty session file. - Crash when trying to load an empty session file.
- `:hint` with an invalid `--mode=` value now shows a proper error. - `:hint` with an invalid `--mode=` value now shows a proper error.
- Rare crash on Qt 5.11.2 when clicking on `<select>` elements. - Rare crash on Qt 5.11.2 when clicking on `<select>` elements.
- Rare crash related to the completion.
Removed Removed
~~~~~~~ ~~~~~~~

View File

@ -24,7 +24,7 @@ import re
from PyQt5.QtCore import Qt, QSortFilterProxyModel, QRegExp from PyQt5.QtCore import Qt, QSortFilterProxyModel, QRegExp
from PyQt5.QtGui import QStandardItem, QStandardItemModel from PyQt5.QtGui import QStandardItem, QStandardItemModel
from qutebrowser.utils import qtutils from qutebrowser.utils import qtutils, log
class ListCategory(QSortFilterProxyModel): class ListCategory(QSortFilterProxyModel):
@ -80,6 +80,13 @@ class ListCategory(QSortFilterProxyModel):
left = self.srcmodel.data(lindex) left = self.srcmodel.data(lindex)
right = self.srcmodel.data(rindex) right = self.srcmodel.data(rindex)
if left is None or right is None:
log.completion.warning("Got unexpected None value, "
"left={!r} right={!r} "
"lindex={!r} rindex={!r}"
.format(left, right, lindex, rindex))
return False
leftstart = left.startswith(self._pattern) leftstart = left.startswith(self._pattern)
rightstart = right.startswith(self._pattern) rightstart = right.startswith(self._pattern)