From 38775fabb0ba518e323f3bf7c10c7c566b1c4e08 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 1 Jun 2018 18:25:52 +0300 Subject: Fix uncaught invalid_path exception --- build2/cc/compile-rule.cxx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx index b06b03b..079be88 100644 --- a/build2/cc/compile-rule.cxx +++ b/build2/cc/compile-rule.cxx @@ -1083,15 +1083,25 @@ namespace build2 continue; dir_path d; - if (o.size () == 2) + + try { - if (++i == e) - break; // Let the compiler complain. + if (o.size () == 2) + { + if (++i == e) + break; // Let the compiler complain. - d = dir_path (*i); + d = dir_path (*i); + } + else + d = dir_path (*i, 2, string::npos); + } + catch (const invalid_path& e) + { + fail << "invalid -I directory " << e.path + << " in variable " << var.name + << " for target " << t; } - else - d = dir_path (*i, 2, string::npos); l6 ([&]{trace << "-I " << d;}); -- cgit v1.1