Explorar el Código

[collections] fixed exception if no results

Exilon hace 4 años
padre
commit
a4d91f69e9
Se han modificado 1 ficheros con 2 adiciones y 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;