Skip to content

Commit f789dad

Browse files
committed
[debugUtils] Enter method detects nil object
1 parent ef20a26 commit f789dad

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Quick.Debug.Utils.pas

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,16 @@ class function TDebugger.TimeIt(aOwner : TObject; const aFunctionName, aDescript
183183

184184
class function TDebugger.Enter(aOwner : TObject; const aFunctionName: string) : IDebugMethodEnter;
185185
begin
186-
fLogger.Debug(Format('[ENTER] >> %s.%s',[aOwner.ClassName,aFunctionName]));
187-
Result := TDebugMethodEnter.Create(fLogger,Format('%s.%s',[aOwner.ClassName,aFunctionName]));
186+
if aOwner <> nil then
187+
begin
188+
fLogger.Debug(Format('[ENTER] >> %s.%s',[aOwner.ClassName,aFunctionName]));
189+
Result := TDebugMethodEnter.Create(fLogger,Format('%s.%s',[aOwner.ClassName,aFunctionName]));
190+
end
191+
else
192+
begin
193+
fLogger.Debug(Format('[ENTER] >> %s',[aFunctionName]));
194+
Result := TDebugMethodEnter.Create(fLogger,aFunctionName);
195+
end;
188196
end;
189197

190198
class function TDebugger.NewChrono(aStarted : Boolean) : IChronometer;

0 commit comments

Comments
 (0)