diff options
author | deva <deva> | 2009-07-30 09:47:03 +0000 |
---|---|---|
committer | deva <deva> | 2009-07-30 09:47:03 +0000 |
commit | 7648d777302595d819e2a34e41bbda157392667b (patch) | |
tree | f97a75e7f87f8156016a043bfd22f7508d3f48af /server/src/macrolist.cc | |
parent | 706e18fae5713e070d6379f1ec9da1757b338f4e (diff) |
Make sure we don't hang in an infinite loop when encountering malformed macro/template files.
Diffstat (limited to 'server/src/macrolist.cc')
-rw-r--r-- | server/src/macrolist.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/server/src/macrolist.cc b/server/src/macrolist.cc index 0e86a47..b67f239 100644 --- a/server/src/macrolist.cc +++ b/server/src/macrolist.cc @@ -63,9 +63,13 @@ MacroList::MacroList(std::string macropath) std::vector<std::string>::iterator i = macros.begin(); while(i != macros.end()) { MacroHeaderParser parser(macropath + "/" + *i); - parser.parse(); - Macro *macro = parser.getMacro(); - (*this)[macro->attributes["name"]][VersionStr(macro->attributes["version"])] = *i; + try { + parser.parse(); + Macro *macro = parser.getMacro(); + (*this)[macro->attributes["name"]][VersionStr(macro->attributes["version"])] = *i; + } catch(Exception &e) { + PRACRO_WARN(macrolist, "Skipping %s: %s\n", i->c_str(), e.what()); + } i++; } |