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] Paint Data: Fix crash on empty data #2399

Merged
merged 2 commits into from Jun 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Orange/widgets/data/owpaintdata.py
Expand Up @@ -797,7 +797,7 @@ def __init__(self):
self.class_model.rowsInserted.connect(self._class_count_changed)
self.class_model.rowsRemoved.connect(self._class_count_changed)

if self.data is None:
if not self.data:
self.data = []
self.__buffer = np.zeros((0, 3))
elif isinstance(self.data, np.ndarray):
Expand Down
7 changes: 7 additions & 0 deletions Orange/widgets/data/tests/test_owpaintdata.py
Expand Up @@ -71,3 +71,10 @@ def test_sparse_data(self):
self.assertTrue(self.widget.Warning.sparse_not_supported.is_shown())
self.send_signal("Data", None)
self.assertFalse(self.widget.Warning.sparse_not_supported.is_shown())

def test_load_empty_data(self):
"""
It should not crash when old workflow with no data is loaded.
GH-2399
"""
self.create_widget(OWPaintData, stored_settings={"data": []})