Просмотр исходного кода

VideoModel: Check for duplicate before append

Soomin Lee 7 лет назад
Родитель
Сommit
c83abf7c31
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      SharedSources/MediaLibraryModel/VideoModel.swift

+ 5 - 0
SharedSources/MediaLibraryModel/VideoModel.swift

@@ -27,6 +27,11 @@ class VideoModel: MLBaseModel {
     }
 
     func append(_ item: VLCMLMedia) {
+        for file in files {
+            if file.identifier() == item.identifier() {
+                return
+            }
+        }
         files.append(item)
     }