Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] OWFeatureStatistics: Don't attempt to sort when no data on input #3449

Merged
merged 1 commit into from
Dec 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Orange/widgets/data/owfeaturestatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ def __restore_selection(self):
def __restore_sorting(self):
"""Restore the sort column and order from saved settings."""
sort_column, sort_order = self.sorting
if sort_column < self.model.columnCount():
if self.data is not None and sort_column < self.model.columnCount():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So __restore_sorting does nothing if self.data is None. In that case maybe it should be called only when self.data is not None (in the set_data method above)? Is the same true for __restore_selection?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about putting the None check in set_data, but decided to put it here instead to keep the __restore_* methods consistent. The other methods properly handle the case where there is no data, only this one fails. It seemed cleaner to just make them all work.

self.model.sort(sort_column, sort_order)
self.table_view.horizontalHeader().setSortIndicator(sort_column, sort_order)

Expand Down