Skip to content

Commit

Permalink
[FIX] OWMosaic: Fix crash for empty column
Browse files Browse the repository at this point in the history
  • Loading branch information
rokgomiscek committed Feb 10, 2017
1 parent 3840b04 commit 8103912
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Orange/widgets/visualize/owmosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def set_data(self, data):
self.closeContext()
self.data = data
self.init_combos(self.data)
if self.data is None or not len(self.data):
if self.data is None or not len(self.data) or not len(self.data[0]):
self.discrete_data = None
elif any(attr.is_continuous for attr in data.domain):
self.discrete_data = Discretize(
Expand Down
4 changes: 4 additions & 0 deletions Orange/widgets/visualize/tests/test_owmosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def test_no_data(self):
"""Check that the widget doesn't crash on empty data"""
self.send_signal("Data", self.data[:0])

def test_empty_column(self):
"""Check that the widget doesn't crash if the columns are empty"""
self.send_signal("Data", self.data[:,:0])

def _select_data(self):
self.widget.select_area(1, QMouseEvent(
QEvent.MouseButtonPress, QPoint(), Qt.LeftButton,
Expand Down

0 comments on commit 8103912

Please sign in to comment.