From 320e849d17597aef40b9e3e62f79319f13f97e45 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 16 May 2018 16:05:05 +0300 Subject: Fix uncaught invalid_path exception --- build2/scope.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'build2/scope.cxx') diff --git a/build2/scope.cxx b/build2/scope.cxx index a15eeba..e5762f1 100644 --- a/build2/scope.cxx +++ b/build2/scope.cxx @@ -569,7 +569,7 @@ namespace build2 static const string file_tt ("file"); const target_type* scope:: - find_target_type (name& n, optional& ext) const + find_target_type (name& n, optional& ext, const location& loc) const { ext = nullopt; @@ -622,7 +622,15 @@ namespace build2 if (i != string::npos) { - n.dir /= dir_path (v, i != 0 ? i : 1); // Special case: "/". + try + { + n.dir /= dir_path (v, i != 0 ? i : 1); // Special case: "/". + } + catch (const invalid_path& e) + { + fail (loc) << "invalid path '" << e.path << "'"; + } + v = string (v, i + 1, string::npos); } -- cgit v1.1