Forráskód Böngészése

[collections] fixed exception if no results

Exilon 4 éve
szülő
commit
a4d91f69e9
1 módosított fájl, 2 hozzáadás és 2 törlés
  1. 2 2
      Quick.Collections.pas

+ 2 - 2
Quick.Collections.pas

@@ -296,7 +296,7 @@ end;
 
 
 function TxList<T>.First: T;
 function TxList<T>.First: T;
 begin
 begin
-  Result := fList.First;
+  if fList.Count > 0 then Result := fList.First;
 end;
 end;
 
 
 procedure TxList<T>.FromList(const aList: TList<T>);
 procedure TxList<T>.FromList(const aList: TList<T>);
@@ -377,7 +377,7 @@ end;
 
 
 function TxList<T>.Last: T;
 function TxList<T>.Last: T;
 begin
 begin
-  Result := fList.Last;
+  if fList.Count > 0 then Result := fList.Last;
 end;
 end;
 
 
 function TxList<T>.LastIndexOf(const Value: T): Integer;
 function TxList<T>.LastIndexOf(const Value: T): Integer;