diff --git a/Orange/widgets/data/owpaintdata.py b/Orange/widgets/data/owpaintdata.py index d9642853735..4d5fc0fd490 100644 --- a/Orange/widgets/data/owpaintdata.py +++ b/Orange/widgets/data/owpaintdata.py @@ -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): diff --git a/Orange/widgets/data/tests/test_owpaintdata.py b/Orange/widgets/data/tests/test_owpaintdata.py index 804fedd5901..ce6b9dd0619 100644 --- a/Orange/widgets/data/tests/test_owpaintdata.py +++ b/Orange/widgets/data/tests/test_owpaintdata.py @@ -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": []})