mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Avoid crashing when clearing cookies for invalid source URLs
e.g. Komga sources with no URLs set
This commit is contained in:
		@@ -115,11 +115,16 @@ class ExtensionDetailsScreenModel(
 | 
			
		||||
 | 
			
		||||
        val urls = extension.sources
 | 
			
		||||
            .filterIsInstance<HttpSource>()
 | 
			
		||||
            .map { it.baseUrl }
 | 
			
		||||
            .mapNotNull { it.baseUrl.takeUnless { url -> url.isEmpty() } }
 | 
			
		||||
            .distinct()
 | 
			
		||||
 | 
			
		||||
        val cleared = urls.sumOf {
 | 
			
		||||
            network.cookieManager.remove(it.toHttpUrl())
 | 
			
		||||
            try {
 | 
			
		||||
                network.cookieManager.remove(it.toHttpUrl())
 | 
			
		||||
            } catch (e: Exception) {
 | 
			
		||||
                logcat(LogPriority.ERROR, e) { "Failed to clear cookies for $it" }
 | 
			
		||||
                0
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        logcat { "Cleared $cleared cookies for: ${urls.joinToString()}" }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user