Abort resizeEvent if model is None.
Some reports came in that a resizeEvent was causing a crash due to the model being none in the CompletionView. Fixes #2854.
This commit is contained in:
parent
b7fe13434b
commit
f09423efe5
@ -148,6 +148,8 @@ class CompletionView(QTreeView):
|
||||
|
||||
def _resize_columns(self):
|
||||
"""Resize the completion columns based on column_widths."""
|
||||
if self.model() is None:
|
||||
return
|
||||
width = self.size().width()
|
||||
column_widths = self.model().column_widths
|
||||
pixel_widths = [(width * perc // 100) for perc in column_widths]
|
||||
|
@ -240,3 +240,8 @@ def test_completion_item_del_no_selection(completionview):
|
||||
with pytest.raises(cmdexc.CommandError, match='No item selected!'):
|
||||
completionview.completion_item_del()
|
||||
assert not func.called
|
||||
|
||||
|
||||
def test_resize_no_model(completionview, qtbot):
|
||||
"""Ensure no crash if resizeEvent is triggered with no model (#2854)."""
|
||||
completionview.resizeEvent(None)
|
||||
|
Loading…
Reference in New Issue
Block a user