kunfei 4 лет назад
Родитель
Сommit
ec8bc7aa33

+ 1 - 1
app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByRegex.kt

@@ -45,7 +45,7 @@ object AnalyzeByRegex {
                 // 新建容器
                 // 新建容器
                 val info = arrayListOf<String>()
                 val info = arrayListOf<String>()
                 for (groupIndex in 0..resM.groupCount()) {
                 for (groupIndex in 0..resM.groupCount()) {
-                    info.add(resM.group(groupIndex)!!)
+                    info.add(resM.group(groupIndex) ?: "")
                 }
                 }
                 books.add(info)
                 books.add(info)
             } while (resM.find())
             } while (resM.find())

+ 2 - 3
app/src/main/java/io/legado/app/model/localBook/TextFile.kt

@@ -124,7 +124,6 @@ class TextFile(private val book: Book) {
                     val chapterStart = matcher.start()
                     val chapterStart = matcher.start()
                     //获取章节内容
                     //获取章节内容
                     val chapterContent = blockContent.substring(seekPos, chapterStart)
                     val chapterContent = blockContent.substring(seekPos, chapterStart)
-                    var mChapterContent = chapterContent
                     val chapterLength = chapterContent.toByteArray(charset).size
                     val chapterLength = chapterContent.toByteArray(charset).size
                     val lastStart = toc.lastOrNull()?.start ?: curOffset
                     val lastStart = toc.lastOrNull()?.start ?: curOffset
                     if (curOffset + chapterLength - lastStart > 50000) {
                     if (curOffset + chapterLength - lastStart > 50000) {
@@ -151,7 +150,7 @@ class TextFile(private val book: Book) {
                         } else { //否则就block分割之后,上一个章节的剩余内容
                         } else { //否则就block分割之后,上一个章节的剩余内容
                             //获取上一章节
                             //获取上一章节
                             val lastChapter = toc.last()
                             val lastChapter = toc.last()
-                            toc.last().isVolume = mChapterContent.substringAfter(lastChapter.title).isBlank()
+                            toc.last().isVolume = chapterContent.substringAfter(lastChapter.title).isBlank()
                             //将当前段落添加上一章去
                             //将当前段落添加上一章去
                             lastChapter.end =
                             lastChapter.end =
                                 lastChapter.end!! + chapterLength.toLong()
                                 lastChapter.end!! + chapterLength.toLong()
@@ -165,7 +164,7 @@ class TextFile(private val book: Book) {
                         if (toc.isNotEmpty()) { //获取章节内容
                         if (toc.isNotEmpty()) { //获取章节内容
                             //获取上一章节
                             //获取上一章节
                             val lastChapter = toc.last()
                             val lastChapter = toc.last()
-                            toc.last().isVolume = mChapterContent.substringAfter(lastChapter.title).isBlank()
+                            toc.last().isVolume = chapterContent.substringAfter(lastChapter.title).isBlank()
                             lastChapter.end =
                             lastChapter.end =
                                 lastChapter.start!! + chapterContent.toByteArray(charset).size.toLong()
                                 lastChapter.start!! + chapterContent.toByteArray(charset).size.toLong()
                             //创建当前章节
                             //创建当前章节