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

Conversation

pavlin-policar
Copy link
Collaborator

Issue

An issue popped up on sentry where Feature Statistics was crashing. This can be reproduced in the following way:

  1. Open a workflow and connect File with some data to Feature Statistics and save the workflow
  2. Remove/rename the data file in question so that the File widget can no longer find it
  3. Re-open the workflow in Orange → Feature statistics crash
Description of changes

Fixes the bug. I have no idea how to test this, or indeed, how this even happened because this issue never occurred when disconnecting data. In both cases, the input signal data was set to None.

Includes
  • Code changes
  • Tests
  • Documentation

@pavlin-policar pavlin-policar changed the title OWFeatureStatistics: Don't attempt to sort when no data on input [FIX] OWFeatureStatistics: Don't attempt to sort when no data on input Dec 7, 2018
@codecov
Copy link

codecov bot commented Dec 7, 2018

Codecov Report

Merging #3449 into master will decrease coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #3449      +/-   ##
==========================================
- Coverage   83.27%   83.27%   -0.01%     
==========================================
  Files         365      365              
  Lines       64305    64305              
==========================================
- Hits        53549    53547       -2     
- Misses      10756    10758       +2

@@ -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.

@lanzagar lanzagar merged commit 751a6c9 into biolab:master Dec 10, 2018
@pavlin-policar pavlin-policar deleted the feature-statistics-fix branch December 10, 2018 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants