add len zero check
@@ -239,7 +239,7 @@ class Models(collections.abc.MutableSequence):
path = make_path(path)
if path.exists() and not overwrite:
raise IOError(f"File exists already: {path}")
- if self._covariance is not None:
+ if self._covariance is not None and len(self.parameters) != 0:
filename = splitext(str(path))[0] + "_covariance.dat"
self._covariance.write(self._models, filename)
path.write_text(self.to_yaml())
