FpDebugger (all): prevent nil deref, for empty watch (auto instance class)

git-svn-id: trunk@62811 -
This commit is contained in:
martin 2020-03-25 15:51:09 +00:00
parent 1f69cf465e
commit 667546f298
3 changed files with 19 additions and 0 deletions

View File

@ -2327,6 +2327,13 @@ begin
FPrettyPrinter.MemManager := AContext.MemManager;
ResValue := APasExpr.ResultValue;
if ResValue = nil then begin
AResText := 'Error';
if AWatchValue <> nil then
AWatchValue.Validity := ddsInvalid;
exit;
end;
if (ResValue.Kind = skClass) and (ResValue.AsCardinal <> 0) and (defClassAutoCast in EvalFlags)
then begin
CastName := '';

View File

@ -1048,6 +1048,12 @@ DebugLn(DBG_VERBOSE, [ErrorHandler.ErrorAsString(PasExpr.Error)]);
if not IsWatchValueAlive then exit;
ResValue := PasExpr.ResultValue;
if ResValue = nil then begin
AResText := 'Error';
if AWatchValue <> nil then
AWatchValue.Validity := ddsInvalid;
exit;
end;
if (ResValue.Kind = skClass) and (ResValue.AsCardinal <> 0) and (defClassAutoCast in EvalFlags)
then begin

View File

@ -1491,6 +1491,12 @@ DebugLn(DBG_VERBOSE, [ErrorHandler.ErrorAsString(PasExpr.Error)]);
if not IsWatchValueAlive then exit;
ResValue := PasExpr.ResultValue;
if ResValue = nil then begin
AResText := 'Error';
if AWatchValue <> nil then
AWatchValue.Validity := ddsInvalid;
exit;
end;
if (ResValue.Kind = skClass) and (ResValue.AsCardinal <> 0) and (defClassAutoCast in EvalFlags)
then begin