Skip to content

Commit 6cd35ad

Browse files
authored
Merge pull request #2399 from jerneju/load-empty-data-paintdata
[FIX] Paint Data: Fix crash on empty data
2 parents 625ff36 + 86ff3d6 commit 6cd35ad

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Orange/widgets/data/owpaintdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ def __init__(self):
797797
self.class_model.rowsInserted.connect(self._class_count_changed)
798798
self.class_model.rowsRemoved.connect(self._class_count_changed)
799799

800-
if self.data is None:
800+
if not self.data:
801801
self.data = []
802802
self.__buffer = np.zeros((0, 3))
803803
elif isinstance(self.data, np.ndarray):

Orange/widgets/data/tests/test_owpaintdata.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,10 @@ def test_sparse_data(self):
7171
self.assertTrue(self.widget.Warning.sparse_not_supported.is_shown())
7272
self.send_signal("Data", None)
7373
self.assertFalse(self.widget.Warning.sparse_not_supported.is_shown())
74+
75+
def test_load_empty_data(self):
76+
"""
77+
It should not crash when old workflow with no data is loaded.
78+
GH-2399
79+
"""
80+
self.create_widget(OWPaintData, stored_settings={"data": []})

0 commit comments

Comments
 (0)