Skip to content

Commit 58079c3

Browse files
committed
headerview: Do nothing in initStyleOptionForIndex if model is None
1 parent a3a3197 commit 58079c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Orange/widgets/utils/headerview.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ def initStyleOptionForIndex(
7070
is used (isSectionSelected will scan the entire model column/row
7171
when the whole column/row is selected).
7272
"""
73+
model = self.model()
74+
if model is None:
75+
return
7376
hover = self.logicalIndexAt(self.mapFromGlobal(QCursor.pos()))
7477
pressed = self.__pressed
7578

@@ -100,7 +103,6 @@ def initStyleOptionForIndex(
100103
)
101104

102105
style = self.style()
103-
model = self.model()
104106
orientation = self.orientation()
105107
textAlignment = model.headerData(logicalIndex, self.orientation(),
106108
Qt.TextAlignmentRole)

0 commit comments

Comments
 (0)