@@ -108,7 +108,7 @@ public static bool CanOpenCodexOnline(Codex? toOpen)
108108 public RelayCommand < IList > OpenSelectedCodicesCommand => _openSelectedCodicesCommand ??= new ( l => OpenSelectedCodices ( l ? . Cast < Codex > ( ) . ToList ( ) ) ) ;
109109 public static bool OpenSelectedCodices ( IList < Codex > ? toOpen )
110110 {
111- if ( toOpen is null ) return false ;
111+ if ( ! toOpen . SafeAny ( ) ) return false ;
112112
113113 if ( toOpen . Count == 1 )
114114 {
@@ -152,7 +152,7 @@ public static void EditCodex(Codex? toEdit)
152152 public static void EditCodices ( IList ? toEdit )
153153 {
154154 List < Codex > ? toEditList = toEdit ? . Cast < Codex > ( ) . ToList ( ) ;
155- if ( toEditList is null ) return ;
155+ if ( ! toEditList . SafeAny ( ) ) return ;
156156
157157 if ( toEditList . Count == 1 )
158158 {
@@ -186,7 +186,8 @@ public static void FavoriteCodex(Codex? toFavorite)
186186 private static void FavoriteCodices ( IList ? toFavorite )
187187 {
188188 List < Codex > ? toFavoriteList = toFavorite ? . Cast < Codex > ( ) . ToList ( ) ;
189- if ( toFavoriteList is null ) return ;
189+ if ( ! toFavoriteList . SafeAny ( ) ) return ;
190+
190191 if ( toFavoriteList . Count == 1 )
191192 {
192193 FavoriteCodex ( toFavoriteList . First ( ) ) ;
@@ -247,6 +248,8 @@ public void MoveToCollection(object[]? par)
247248 /// <param name="toMoveList"></param>
248249 public static void MoveToCollection ( CodexCollection targetCollection , List < Codex > toMoveList )
249250 {
251+ if ( ! toMoveList . Any ( ) ) return ;
252+
250253 //Check if target Collection is valid
251254 if ( targetCollection . DirectoryName == MainViewModel . CollectionVM . CurrentCollection . DirectoryName )
252255 {
@@ -324,6 +327,8 @@ public static void DeleteCodex(Codex? toDelete)
324327 public RelayCommand < IList > DeleteCodicesCommand => _deleteCodicesCommand ??= new ( DeleteCodices ) ;
325328 public static void DeleteCodices ( IList ? toDelete )
326329 {
330+ if ( toDelete == null || toDelete . Count == 0 ) return ;
331+
327332 MainViewModel . CollectionVM . CurrentCollection . DeleteCodices ( toDelete ? . Cast < Codex > ( ) . ToList ( ) ?? new ( ) ) ;
328333 MainViewModel . CollectionVM . FilterVM . ReFilter ( ) ;
329334 }
@@ -341,6 +346,8 @@ public static void DeleteCodices(IList? toDelete)
341346 public RelayCommand < IList > BanishCodicesCommand => _banishCodicesCommand ??= new ( BanishCodices ) ;
342347 public static void BanishCodices ( IList ? toBanish )
343348 {
349+ if ( toBanish == null || toBanish . Count == 0 ) return ;
350+
344351 MainViewModel . CollectionVM . CurrentCollection . BanishCodices ( toBanish ? . Cast < Codex > ( ) . ToList ( ) ?? new ( ) ) ;
345352 DeleteCodices ( toBanish ) ;
346353 }
@@ -362,6 +369,8 @@ public static async Task StartGetMetaDataProcess(Codex? codex)
362369 }
363370 public static async Task StartGetMetaDataProcess ( IList < Codex > codices )
364371 {
372+ if ( ! codices . Any ( ) ) return ;
373+
365374 var progressVM = ProgressViewModel . GetInstance ( ) ;
366375 progressVM . ResetCounter ( ) ;
367376 progressVM . Text = "Getting MetaData" ;
0 commit comments