Răsfoiți Sursa

[collections] fixed exception if no results

Exilon 4 ani în urmă
părinte
comite
a4d91f69e9
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      Quick.Collections.pas

+ 2 - 2
Quick.Collections.pas

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