Explorar o código

[collections] fixed exception if no results

Exilon %!s(int64=4) %!d(string=hai) anos
pai
achega
a4d91f69e9
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  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;