summaryrefslogtreecommitdiff
path: root/server/src/templatelist.cc
diff options
context:
space:
mode:
authordeva <deva>2009-07-30 09:47:03 +0000
committerdeva <deva>2009-07-30 09:47:03 +0000
commit7648d777302595d819e2a34e41bbda157392667b (patch)
treef97a75e7f87f8156016a043bfd22f7508d3f48af /server/src/templatelist.cc
parent706e18fae5713e070d6379f1ec9da1757b338f4e (diff)
Make sure we don't hang in an infinite loop when encountering malformed macro/template files.
Diffstat (limited to 'server/src/templatelist.cc')
-rw-r--r--server/src/templatelist.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/server/src/templatelist.cc b/server/src/templatelist.cc
index 2e6f176..cdf2b4b 100644
--- a/server/src/templatelist.cc
+++ b/server/src/templatelist.cc
@@ -63,9 +63,14 @@ TemplateList::TemplateList(std::string templatepath)
std::vector<std::string>::iterator i = templates.begin();
while(i != templates.end()) {
TemplateHeaderParser parser(templatepath + "/" + *i);
- parser.parse();
- Template *templ = parser.getTemplate();
- (*this)[templ->attributes["name"]][VersionStr(templ->attributes["version"])] = *i;
+ try {
+ parser.parse();
+ Template *templ = parser.getTemplate();
+ (*this)[templ->attributes["name"]][VersionStr(templ->attributes["version"])] = *i;
+ } catch(Exception &e) {
+ PRACRO_WARN(templatelist, "Skipping %s: %s\n", i->c_str(), e.what());
+ }
+
i++;
}