mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 10:03:56 +01:00
fix: a {.command.} resulting in an empty string could actually produce a false error
This commit is contained in:
parent
ad439fa65f
commit
62c30c8de1
@ -161,16 +161,18 @@ var
|
||||
procedure deprecatedMacro(what:string=''; instead:string='');
|
||||
begin mainfrm.add2log('WARNING, deprecated macro: '+first(what, name)+nonEmptyConcat(' - Use instead: ',instead), NIL, clRed) end;
|
||||
|
||||
procedure unsatisfied(b:boolean=TRUE);
|
||||
begin
|
||||
if b then
|
||||
macroError('cannot be used here')
|
||||
end;
|
||||
|
||||
function satisfied(p:pointer):boolean;
|
||||
begin
|
||||
result:=assigned(p);
|
||||
if not result then
|
||||
macroError('cannot be used here');
|
||||
unsatisfied(not result);
|
||||
end;
|
||||
|
||||
procedure unsatisfied(b:boolean=TRUE);
|
||||
begin if b then macroError('cannot be used here') end;
|
||||
|
||||
function parEx(idx:integer; name:string=''; doTrim:boolean=TRUE):string; overload;
|
||||
var
|
||||
i: integer;
|
||||
@ -262,9 +264,9 @@ var
|
||||
result:=staticVars;
|
||||
delete(varname,1,length(G_VAR_PREFIX));
|
||||
end
|
||||
else if satisfied(md.cd) then
|
||||
else if assigned(md.cd) then
|
||||
result:=md.cd.vars
|
||||
else if satisfied(md.tempVars) then
|
||||
else if assigned(md.tempVars) then
|
||||
result:=md.tempVars
|
||||
else
|
||||
raise Exception.create('no namespace available');
|
||||
@ -293,7 +295,7 @@ var
|
||||
if not satisfied(space) then exit;
|
||||
i:=space.indexOfName(varname);
|
||||
if i < 0 then
|
||||
if value = '' then exit // all is good the way it is
|
||||
if value = '' then exit(TRUE) // all is good the way it is
|
||||
else i:=space.add(varname+'='+value)
|
||||
else
|
||||
if value > '' then // in case of empty value, there's no need to assign, because we are going to delete it (after we cleared the bound object)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user