From 689b9fefc0dbb8cf17ebf03314c2b4e20e653773 Mon Sep 17 00:00:00 2001 From: Kai Ni Date: Fri, 19 Feb 2010 22:44:45 +0000 Subject: [PATCH] throw exceptions instead of crashing --- cpp/BayesTree-inl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/BayesTree-inl.h b/cpp/BayesTree-inl.h index 94980879f..a41965b20 100644 --- a/cpp/BayesTree-inl.h +++ b/cpp/BayesTree-inl.h @@ -95,6 +95,7 @@ namespace gtsam { /* ************************************************************************* */ template void BayesTree::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_);