Fetching Empty-GUIDs

Maybe it's worth adding TGUID.Empty check in TObjectManager.Find?

function TObjectManager.Find<E>(const IdValue: TGuid): E;
begin
  // >>>
  if IdValue.IsEmpty then
    Exit(nil);
  // <<<
  Result := Find<E>(GuidToString(IdValue));
end;

Or doing this using a new property "ProhibitFetchEmptyGUID" on TObjectManager, so that current behaviour does not change?

I don't see a use for that, the equivalent Find<E>(const IdValue: Variant) does not perform any check either. It's up to the caller to do that check.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.