Permalink
Browse files

Bugfix: Unknown cmd-line options caused a crash. Reported by nop head.

  • Loading branch information...
1 parent b902252 commit bddf392281d20bf1ad763577c8d3a846c5891ab9 @kintel kintel committed Feb 19, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/openscad.cc
View
@@ -149,9 +149,14 @@ int main(int argc, char **argv)
all_options.add(desc).add(hidden);
po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).options(all_options).positional(p).run(), vm);
-// po::notify(vm);
-
+ try {
+ po::store(po::command_line_parser(argc, argv).options(all_options).positional(p).run(), vm);
+ }
+ catch(std::exception &e) { // Catches e.g. unknown options
+ fprintf(stderr, "%s\n", e.what());
+ help(argv[0]);
+ }
+
if (vm.count("help")) help(argv[0]);
if (vm.count("version")) version();

0 comments on commit bddf392

Please sign in to comment.