message: Fix segfaults when OSPRay cmdline parser expects arguments
diff: @@ -61,9 +61,15 @@ namespace ospray {
  device->findParam("logLevel", true)->set(2);
  removeArgs(ac,av,i,1);
  } else if (parm == "--osp:loglevel") {
  + if (i+1<ac) {
  device->findParam("logLevel", true)->set(atoi(av[i+1]));
  removeArgs(ac,av,i,2);
  + } else {
  + postStatusMsg("<n> argument required for --osp:loglevel!");
  + removeArgs(ac,av,i,1);
  + }
  } else if (parm == "--osp:logoutput") {
  + if (i+1<ac) {
  std::string dst = av[i+1];
  if (dst == "cout" || dst == "cerr")
  @@ -72,7 +78,12 @@ namespace ospray {
  postStatusMsg("You must use 'cout' or 'cerr' for --osp:logoutput!");
  removeArgs(ac,av,i,2);
  + } else {
  + postStatusMsg("<dst> argument required for --osp:logoutput!");
  + removeArgs(ac,av,i,1);
  + }
  } else if (parm == "--osp:erroroutput") {
  + if (i+1<ac) {
  std::string dst = av[i+1];
  if (dst == "cout" || dst == "cerr")
  @@ -83,12 +94,26 @@ namespace ospray {
  }
  removeArgs(ac,av,i,2);
  + } else {
  + postStatusMsg("<dst> argument required for --osp:erroroutput!");
  + removeArgs(ac,av,i,1);
  + }
  } else if (parm == "--osp:numthreads" || parm == "--osp:num-threads") {
  + if (i+1<ac) {
  device->findParam("numThreads", true)->set(atoi(av[i+1]));
  removeArgs(ac,av,i,2);
  + } else {
  + postStatusMsg("<n> argument required for --osp:numthreads");
  + removeArgs(ac,av,i,1);
  + }
  } else if (parm == "--osp:setaffinity" || parm == "--osp:affinity") {
  + if (i+1<ac) {
  device->findParam("setAffinity", true)->set(atoi(av[i+1]));
  removeArgs(ac,av,i,2);
  + } else {
  + postStatusMsg("<n> argument required for --osp:setaffinity!");
  + removeArgs(ac,av,i,1);
  + }
  } else {
  ++i;
  }
  