This project is read-only.
1

Closed

Reviews page exception when items are more then 45.

description

When the review items are more then 45, it will raise the null ref exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at VirtoCommerce.ManagementClient.Reviews.ViewModel.Implementations.ReviewsHomeViewModel.<SetItemsStatus>b__6(VirtualListItem1 rev)
at System.Linq.Enumerable.WhereEnumerableIterator
1.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at VirtoCommerce.ManagementClient.Reviews.ViewModel.Implementations.ReviewsHomeViewModel.SetItemsStatus()
at VirtoCommerce.ManagementClient.Reviews.ViewModel.Implementations.ReviewsHomeViewModel.LoadRange(Int32 startIndex, Int32 count, SortDescriptionCollection sortDescriptions, Int32& overallCount)
at VirtoCommerce.ManagementClient.Core.Infrastructure.DataVirtualization.VirtualList
1.LoadRange(Int32 startIndex, Int32 count)
at VirtoCommerce.ManagementClient.Core.Infrastructure.Common.QueuedBackgroundWorker`1.Process(Object arg)

file attachments

Closed Feb 24, 2015 at 7:19 PM by Woland

comments

yurukai wrote Jul 10, 2014 at 8:37 AM

exceptions at:
    private void SetItemsStatus()
    {
        ItemsSource.SourceCollection.Cast<VirtualListItem<IReviewEditViewModel>>().
                Where(rev => rev != null && rev.Data != null && rev.Data.InnerItem.Status == (int)ReviewStatus.Pending).
                ToList().ForEach(item => item.Data.InnerItem.SetStatus = _setAll);
        RaiseCanExecuteChanged();
    }

    private bool IsAnySelected()
    {
        return ItemsSource != null && ItemsSource.SourceCollection.Cast<VirtualListItem<IReviewEditViewModel>>().
                Any(rev => rev != null && rev.Data != null && rev.Data.InnerItem.SetStatus);
    }

yurukai wrote Jul 10, 2014 at 8:38 AM

rev != null && rev.Data != null &&
This codes I added to fix this exception temporarily..

pdator wrote Jul 10, 2014 at 11:22 AM

good catch!
Will fix that as well.
Thank you.