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 17, 2017
1 parent 6ca41f6 commit 21d3da1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Orange/widgets/visualize/owmosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ 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 \
any(attr.is_discrete or attr.is_continuous for attr in chain(data.domain, data.domain.metas)):
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 21d3da1

Please sign in to comment.