From ec94666f91425ee91072f116d47cace89cdc5506 Mon Sep 17 00:00:00 2001 From: Soomin Lee <bubu@mikan.io> Date: Thu, 17 Oct 2019 13:43:46 +0200 Subject: [PATCH] MediaLibraryService: Handle unhandled exceptions --- SharedSources/MediaLibraryService.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/SharedSources/MediaLibraryService.swift b/SharedSources/MediaLibraryService.swift index 096451387..219f15243 100644 --- a/SharedSources/MediaLibraryService.swift +++ b/SharedSources/MediaLibraryService.swift @@ -662,3 +662,18 @@ extension MediaLibraryService { } } } + +// MARK: - VLCMediaLibraryDelegate - Exception handling + +extension MediaLibraryService { + func medialibrary(_ medialibrary: VLCMediaLibrary, + unhandledExceptionWithContext context: String, + errorMessage: String, clearSuggested: Bool) -> Bool { + if clearSuggested { + medialib.clearDatabase(restorePlaylists: true) + setupMediaLibrary() + return true + } + return false + } +} -- GitLab