diff --git a/README.md b/README.md index f471eff3..4ff0b52a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ of Ashampoo Photos, which, in turn, is driven by user community feedback. ## Installation ``` -implementation("com.ashampoo:kim:0.13.1") +implementation("com.ashampoo:kim:0.13.2") ``` ## Sample usages diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkText.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkText.kt index 36ab965e..90c3aa86 100644 --- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkText.kt +++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkText.kt @@ -35,21 +35,19 @@ class PngChunkText( init { - val index = bytes.indexOfNullTerminator() + val nullTerminatorIndex = bytes.indexOfNullTerminator() - if (index < 0) + if (nullTerminatorIndex < 0) throw ImageReadException("PNG tEXt chunk keyword is not terminated.") keyword = bytes.copyOfRange( fromIndex = 0, - toIndex = index + toIndex = nullTerminatorIndex ).decodeLatin1BytesToString() - val textLength = bytes.size - (index + 1) - text = bytes.copyOfRange( - fromIndex = index + 1, - toIndex = textLength + fromIndex = nullTerminatorIndex + 1, + toIndex = bytes.size ).decodeLatin1BytesToString() }