File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
OneDrive-Cloud-Player/ViewModels Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -640,11 +640,14 @@ public void Activate(object mediaWrapper)
640640 {
641641 // Set the field so the playmedia method can use it.
642642 MediaWrapper = ( MediaWrapper ) mediaWrapper ;
643- MediaListIndex = App . Current . MediaItemList . IndexOf ( MediaWrapper . CachedDriveItem ) ;
643+ var list = App . Current . MediaItemList ;
644644
645- if ( MediaListIndex < 0 )
645+ // TODO: fix underlying issue where all properties of MediaWrapper.CachedDriveItem match
646+ // with an item in the list, but the hashcode doesn't. List.Contains works around this,
647+ // where IndexOf would return -1.
648+ if ( list . Contains ( MediaWrapper . CachedDriveItem ) )
646649 {
647- throw new InvalidOperationException ( String . Format ( "Object of type '{0}' not found." , ( MediaWrapper . CachedDriveItem ) . GetType ( ) ) ) ;
650+ MediaListIndex = list . IndexOf ( MediaWrapper . CachedDriveItem ) ;
648651 }
649652 }
650653
You can’t perform that action at this time.
0 commit comments