Quote Originally Posted by Robert Kosek
Doesn't this give you a warning? result may be undefined if you pass a string that you don't have.
If so then you (the programmer) has a problem and not the unit.
:shock:

Can I disagree completely with that ?
How do you test if the returned object is valid ? In such case you should return nil if you don't find the item.
btw the corrected method is very simple:

[pascal]
function TTextureSystem.FindItem(TexID: string): TTextureItem;
var i: integer;
begin
for i := 0 to count-1 do
if Items[i].TexId = TexID then begin
result := Items[i];
exit;
end;
result:=nil;
end;
[/pascal]

Edited: damned Java