You are not logged in.
Pages: 1
If it is not set to NIL first, memory error exception will occur when calling this variable under some tests.
mormot.core.mustache
......
procedure TSynMustache.RenderContext(Context: TSynMustacheContext;
TagStart, TagEnd: integer);
var
partial: TSynMustache;
begin
//add partial:=nil;
partial:=nil;
......
while TagStart <= TagEnd do
......
Offline
It does not make much sense, because this local variable is only used within the mtPartial state:
mtPartial:
begin
partial := fInternalPartials.GetPartial(Value);
The compiler even complains that this assignment is never used.
Online
Modify here in my code
mtPartial:
begin
partial := nil; //add here
if fInternalPartials <> nil then // if not,will Throw an exception In the next line of code
partial := fInternalPartials.GetPartial(Value);
if (partial = nil) and (Context.fOwner <> self) then
// recursive call
partial := Context.fOwner.fInternalPartials.GetPartial(Value);
if (partial = nil) and (Context.Partials <> nil) then
partial := Context.Partials.GetPartial(Value);
if partial <> nil then
partial.RenderContext(Context, 0, high(partial.fTags));
end;
Offline
Pages: 1