aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-09-14 21:09:39 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-09-14 21:09:39 +0300
commit8be04421d177970077287cad2dced9d6683cfe2b (patch)
tree9b5387cb8e1b41b50f41622121f22b3873f95b12
parent1633857d1114107e73fe754a38071ef72e66fe08 (diff)
Fix uncaught invalid_path exception
-rw-r--r--build2/parser.cxx43
1 files changed, 25 insertions, 18 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 3c8e3ac..885b0c1 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -3879,28 +3879,35 @@ namespace build2
string t1;
const string* tp1 (tp);
- if (p == string::npos) // type
- tp1 = &val;
- else if (p == n) // directory
+ try
{
- if (dp == nullptr)
- d1 = dir_path (val);
- else
- d1 = *dp / dir_path (val);
+ if (p == string::npos) // type
+ tp1 = &val;
+ else if (p == n) // directory
+ {
+ if (dp == nullptr)
+ d1 = dir_path (val);
+ else
+ d1 = *dp / dir_path (val);
- dp1 = &d1;
- }
- else // both
- {
- t1.assign (val, p + 1, n - p);
+ dp1 = &d1;
+ }
+ else // both
+ {
+ t1.assign (val, p + 1, n - p);
- if (dp == nullptr)
- d1 = dir_path (val, 0, p + 1);
- else
- d1 = *dp / dir_path (val, 0, p + 1);
+ if (dp == nullptr)
+ d1 = dir_path (val, 0, p + 1);
+ else
+ d1 = *dp / dir_path (val, 0, p + 1);
- dp1 = &d1;
- tp1 = &t1;
+ dp1 = &d1;
+ tp1 = &t1;
+ }
+ }
+ catch (const invalid_path& e)
+ {
+ fail (t) << "invalid path '" << e.path << "'";
}
count = parse_names_trailer (