Back

LL025

Direct nil comparison

Object Pascal — Delphi & Free Pascal
Info
Style

Assigned() is the idiomatic Delphi way to check for nil and works with both objects and interfaces

Assigned() is the idiomatic Delphi way to check for nil and works with both objects and interfaces.

Why this severity

Assigned() is the idiomatic Delphi way to check for nil and works with both objects and interfaces.


Known false positives

comparisons in low-level pointer code where Assigned() may not apply.

Remediation example

if not Assigned(Obj) then
  HandleNil;
// instead of: if Obj = nil then

Reconnecting… Connection lost. Reload