File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -487,7 +487,7 @@ InternalValue SequenceAccessor::Filter(const InternalValue& baseVal, RenderConte
487
487
switch (m_mode)
488
488
{
489
489
case FirstItemMode:
490
- if (listSize)
490
+ if (listSize && *listSize > 0 )
491
491
result = ProtectedValue ( list.GetValueByIndex (0 ) );
492
492
else
493
493
{
@@ -497,7 +497,7 @@ InternalValue SequenceAccessor::Filter(const InternalValue& baseVal, RenderConte
497
497
}
498
498
break ;
499
499
case LastItemMode:
500
- if (listSize)
500
+ if (listSize && *listSize > 0 )
501
501
result = ProtectedValue (list.GetValueByIndex (listSize.value () - 1 ));
502
502
else
503
503
{
@@ -508,7 +508,7 @@ InternalValue SequenceAccessor::Filter(const InternalValue& baseVal, RenderConte
508
508
}
509
509
break ;
510
510
case LengthMode:
511
- if (listSize)
511
+ if (listSize && *listSize > 0 )
512
512
result = static_cast <int64_t >(listSize.value ());
513
513
else
514
514
result = static_cast <int64_t >(std::distance (list.begin (), list.end ()));
@@ -517,7 +517,7 @@ InternalValue SequenceAccessor::Filter(const InternalValue& baseVal, RenderConte
517
517
{
518
518
std::random_device rd;
519
519
std::mt19937 gen (rd ());
520
- if (listSize)
520
+ if (listSize && *listSize > 0 )
521
521
{
522
522
std::uniform_int_distribution<> dis (0 , static_cast <int >(listSize.value ()) - 1 );
523
523
result = ProtectedValue (list.GetValueByIndex (dis (gen)));
You can’t perform that action at this time.
0 commit comments