@@ -371,6 +371,11 @@ function TLinqQuery<T>.Select(const aPropertyName: string): TFlexArray;
371
371
if fWhereClause = nil then raise ELinqNotValidExpression.Create(' Not valid expression defined!' );
372
372
for obj in fList do
373
373
begin
374
+ { $IFNDEF FPC}
375
+ if obj = nil then continue;
376
+ { $ELSE}
377
+ if Pointer(obj) = nil then continue;
378
+ { $ENDIF}
374
379
if fWhereClause.Validate(obj) then
375
380
begin
376
381
// value := TRTTI.GetProperty(obj,aPropertyName);
@@ -396,6 +401,11 @@ function TLinqQuery<T>.Select: TxArray<T>;
396
401
if fWhereClause = nil then raise ELinqNotValidExpression.Create(' Not valid expression defined!' );
397
402
for obj in fList do
398
403
begin
404
+ { $IFNDEF FPC}
405
+ if obj = nil then continue;
406
+ { $ELSE}
407
+ if Pointer(obj) = nil then continue;
408
+ { $ENDIF}
399
409
if fWhereClause.Validate(obj) then Result.Add(obj);
400
410
end ;
401
411
DoOrderBy(Result);
@@ -412,6 +422,11 @@ function TLinqQuery<T>.SelectFirst: T;
412
422
if fWhereClause = nil then raise ELinqNotValidExpression.Create(' Not valid expression defined!' );
413
423
for obj in fList do
414
424
begin
425
+ { $IFNDEF FPC}
426
+ if obj = nil then continue;
427
+ { $ELSE}
428
+ if Pointer(obj) = nil then continue;
429
+ { $ENDIF}
415
430
if fWhereClause.Validate(obj) then Exit(obj);
416
431
end ;
417
432
end ;
@@ -427,6 +442,11 @@ function TLinqQuery<T>.SelectLast: T;
427
442
if fWhereClause = nil then raise ELinqNotValidExpression.Create(' Not valid expression defined!' );
428
443
for obj in fList do
429
444
begin
445
+ { $IFNDEF FPC}
446
+ if obj = nil then continue;
447
+ { $ELSE}
448
+ if Pointer(obj) = nil then continue;
449
+ { $ENDIF}
430
450
if fWhereClause.Validate(obj) then Result := obj;
431
451
end ;
432
452
end ;
@@ -446,6 +466,11 @@ function TLinqQuery<T>.SelectTop(aLimit: Integer): TxArray<T>;
446
466
i := 0 ;
447
467
for obj in fList do
448
468
begin
469
+ { $IFNDEF FPC}
470
+ if obj = nil then continue;
471
+ { $ELSE}
472
+ if Pointer(obj) = nil then continue;
473
+ { $ENDIF}
449
474
if fWhereClause.Validate(obj) then
450
475
begin
451
476
Result.Add(obj);
0 commit comments