fix: use null-safe access for matcher.group(1) in fullTextBuilder
Prevents potential NPE when imgPattern matches but group(1) is null.
This commit is contained in:
@@ -288,7 +288,7 @@ class TextChapterLayout(
|
|||||||
val matcher = AppPattern.imgPattern.matcher(text)
|
val matcher = AppPattern.imgPattern.matcher(text)
|
||||||
var start = 0
|
var start = 0
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
val imgSrc = matcher.group(1)!!
|
val imgSrc = matcher.group(1) ?: continue
|
||||||
val iStyle = if (imgSrc.contains("TEXT")) "text" else imageStyle
|
val iStyle = if (imgSrc.contains("TEXT")) "text" else imageStyle
|
||||||
if (start < matcher.start()) {
|
if (start < matcher.start()) {
|
||||||
fullTextBuilder.append(text.substring(start, matcher.start()))
|
fullTextBuilder.append(text.substring(start, matcher.start()))
|
||||||
|
|||||||
Reference in New Issue
Block a user