throw exceptions instead of crashing

release/4.3a0
Kai Ni 2010-02-19 22:44:45 +00:00
parent d0ce5d36da
commit 689b9fefc0
1 changed files with 1 additions and 0 deletions

View File

@ -95,6 +95,7 @@ namespace gtsam {
/* ************************************************************************* */
template<class Conditional>
void BayesTree<Conditional>::saveGraph(const std::string &s) const {
if (!root_.get()) throw invalid_argument("the root of bayes tree has not been initialized!");
ofstream of(s.c_str());
of<< "digraph G{\n";
saveGraph(of, root_);