Skip to content

Commit e33e6ff

Browse files
author
Martin D. Weinberg
committed
Throw runtime exception if the user tries to write an HDF5 coefficient file from an empty Coefs instance
1 parent 55232f4 commit e33e6ff

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

expui/Coefficients.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,6 +2573,18 @@ namespace CoefClasses
25732573

25742574
void Coefs::WriteH5Coefs(const std::string& prefix)
25752575
{
2576+
// Sanity check: throw runtime error if there are no coefficient
2577+
// sets
2578+
//
2579+
if (Times().size() == 0) {
2580+
throw std::runtime_error
2581+
("Coefs::WriteH5Coefs: "
2582+
"we have NO coefficient sets...continuing without writing"
2583+
);
2584+
}
2585+
2586+
// Write coefficients
2587+
//
25762588
try {
25772589
// Create a new hdf5 file
25782590
//

0 commit comments

Comments
 (0)