Error handling for chapter date parsing (#8391)
This commit is contained in:
		
							parent
							
								
									7448de3f32
								
							
						
					
					
						commit
						90e11ca177
					
				@ -14,6 +14,7 @@ import okhttp3.Request
 | 
			
		||||
import okhttp3.Response
 | 
			
		||||
import org.jsoup.nodes.Document
 | 
			
		||||
import org.jsoup.nodes.Element
 | 
			
		||||
import java.text.ParseException
 | 
			
		||||
import java.text.SimpleDateFormat
 | 
			
		||||
import java.util.Locale
 | 
			
		||||
import java.util.concurrent.TimeUnit
 | 
			
		||||
@ -165,7 +166,12 @@ abstract class Zbulu(
 | 
			
		||||
        return if (this.isNullOrEmpty()) {
 | 
			
		||||
            0
 | 
			
		||||
        } else {
 | 
			
		||||
            dateFormat.parse(this)?.time ?: 0
 | 
			
		||||
            // In the event site displays invalid date
 | 
			
		||||
            try {
 | 
			
		||||
                dateFormat.parse(this)?.time ?: 0
 | 
			
		||||
            } catch (_: ParseException) {
 | 
			
		||||
                0
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,7 @@ class ZbuluGenerator : ThemeSourceGenerator {
 | 
			
		||||
 | 
			
		||||
    override val themeClass = "Zbulu"
 | 
			
		||||
 | 
			
		||||
    override val baseVersionCode: Int = 1
 | 
			
		||||
    override val baseVersionCode: Int = 2
 | 
			
		||||
 | 
			
		||||
    override val sources = listOf(
 | 
			
		||||
        SingleLang("HolyManga", "https://w15.holymanga.net", "en", overrideVersionCode = 1),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user