From 9d5b213893a79939ac8f2e871e18ba3163eeab50 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Tue, 17 May 2011 10:20:19 -0700 Subject: minor feature etc. * add commit notification. * fix relative VAR references that traverse up to root level. --- src/cstore/cstore-varref.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/cstore') diff --git a/src/cstore/cstore-varref.cpp b/src/cstore/cstore-varref.cpp index 7549834..efe1b04 100644 --- a/src/cstore/cstore-varref.cpp +++ b/src/cstore/cstore-varref.cpp @@ -140,18 +140,21 @@ Cstore::VarRef::process_ref(const Cpath& ref_comps, return; } pcomps.pop(); - def = _cstore->parseTmpl(pcomps, false); - if (!def.get()) { - // invalid tmpl path - return; - } - if (def->isTagValue()) { - // at "tag value", need to pop one more. - if (pcomps.size() == 0) { - // invalid path + if (pcomps.size() > 0) { + // not at root yet + def = _cstore->parseTmpl(pcomps, false); + if (!def.get()) { + // invalid tmpl path return; } - pcomps.pop(); + if (def->isTagValue()) { + // at "tag value", need to pop one more. + if (pcomps.size() == 0) { + // invalid path + return; + } + pcomps.pop(); + } } process_ref(rcomps, pcomps, ERROR_TYPE); } else if (cr_comp == "@@") { -- cgit v1.2.3