2
0
Эх сурвалжийг харах

[collections] fixed exception if no results

Exilon 4 жил өмнө
parent
commit
a4d91f69e9
1 өөрчлөгдсөн 2 нэмэгдсэн , 2 устгасан
  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;