From 19bb62917f765c3fa11d1d4c5f88c445e22f227a Mon Sep 17 00:00:00 2001 From: Frederic Boisnard Date: Thu, 16 Feb 2012 17:11:49 +0100 Subject: PFW: Fixed bug when entering empty rule BZ: 24081 When entering an empty rule (composed of spaces), the PFW used to crash. Now an error message is displayed : "Syntax error, no rule found". Change-Id: If3cb505f879d006309add46d5c7c4f47325af563 Reviewed-on: http://android.intel.com:8080/35613 Reviewed-by: Boisnard, FredericX Reviewed-by: Denneulin, GuillaumeX Reviewed-by: Centelles, Sylvain Tested-by: Barthes, FabienX Reviewed-by: buildbot Tested-by: buildbot --- parameter/RuleParser.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'parameter/RuleParser.cpp') diff --git a/parameter/RuleParser.cpp b/parameter/RuleParser.cpp index b72556b..0258adf 100644 --- a/parameter/RuleParser.cpp +++ b/parameter/RuleParser.cpp @@ -121,8 +121,20 @@ bool CRuleParser::parse(CCompoundRule* pParentRule, string& strError) // Go on break; } - case EDone: - return true; + case EDone: { + // If the current state is EDone, check that at least one rule has been found. + if (_pRootRule) { + + // At least one rule found + return true; + } else { + + strError = "Syntax error, no rule found"; + + return false; + } + + } default: assert(0); return false; -- cgit v1.1