diff options
Diffstat (limited to 'libbuild2/version/init.cxx')
-rw-r--r-- | libbuild2/version/init.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libbuild2/version/init.cxx b/libbuild2/version/init.cxx index c8e8559..135f2db 100644 --- a/libbuild2/version/init.cxx +++ b/libbuild2/version/init.cxx @@ -68,16 +68,19 @@ namespace build2 { if (nv.name == "name") { - auto& pn (cast<project_name> (rs.vars[ctx.var_project])); + auto* pn (cast_null<project_name> (rs.vars[ctx.var_project])); - if (nv.value != pn.string ()) + if (pn == nullptr) + fail (l) << "version module loaded in unnamed project"; + + if (nv.value != pn->string ()) { path bf (rs.src_path () / rs.root_extra->bootstrap_file); location ml (f, nv.value_line, nv.value_column); location bl (bf); fail (ml) << "package name " << nv.value << " does not match " - << "build system project name " << pn << + << "build system project name " << *pn << info (bl) << "build system project name specified here"; } } |