File tree Expand file tree Collapse file tree 2 files changed +6
-16
lines changed
v2rayN/ServiceLib/ViewModels Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -188,14 +188,9 @@ public async Task RefreshSubscriptions()
188188 {
189189 SubItems . Add ( item ) ;
190190 }
191- if ( _subIndexId != null && SubItems . FirstOrDefault ( t => t . Id == _subIndexId ) != null )
192- {
193- SelectedSub = SubItems . FirstOrDefault ( t => t . Id == _subIndexId ) ;
194- }
195- else
196- {
197- SelectedSub = SubItems . First ( ) ;
198- }
191+ SelectedSub = ( _config . SubIndexId . IsNotEmpty ( )
192+ ? SubItems . FirstOrDefault ( t => t . Id == _config . SubIndexId )
193+ : null ) ?? SubItems . LastOrDefault ( ) ;
199194 }
200195
201196 private async Task < List < ProfileItemModel > ? > GetProfileItemsEx ( string subid , string filter )
Original file line number Diff line number Diff line change @@ -391,14 +391,9 @@ private async Task RefreshSubscriptions()
391391 {
392392 SubItems . Add ( item ) ;
393393 }
394- if ( _config . SubIndexId != null && SubItems . FirstOrDefault ( t => t . Id == _config . SubIndexId ) != null )
395- {
396- SelectedSub = SubItems . FirstOrDefault ( t => t . Id == _config . SubIndexId ) ;
397- }
398- else
399- {
400- SelectedSub = SubItems . First ( ) ;
401- }
394+ SelectedSub = ( _config . SubIndexId . IsNotEmpty ( )
395+ ? SubItems . FirstOrDefault ( t => t . Id == _config . SubIndexId )
396+ : null ) ?? SubItems . LastOrDefault ( ) ;
402397 }
403398
404399 private async Task < List < ProfileItemModel > ? > GetProfileItemsEx ( string subid , string filter )
You can’t perform that action at this time.
0 commit comments