Skip to content

Commit 4b4c628

Browse files
committed
Update check
1 parent 06621fa commit 4b4c628

File tree

1 file changed

+1
-3
lines changed
  • runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/compression

1 file changed

+1
-3
lines changed

runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/compression/GzipCompressor.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ internal class GzipCompressor : Closeable {
100100
stream.avail_out = BUFFER_SIZE.toUInt()
101101

102102
val deflateResult = deflate(stream.ptr, Z_FINISH)
103-
if (deflateResult != Z_STREAM_END && deflateResult != Z_OK) {
104-
throw RuntimeException("Deflate failed during finish with error code $deflateResult")
105-
}
103+
check(deflateResult == Z_OK || deflateResult == Z_STREAM_END) { "Deflate failed during finish with error code $deflateResult" }
106104

107105
val bytesWritten = BUFFER_SIZE - stream.avail_out.toInt()
108106
outputBuffer.addAll(buffer.take(bytesWritten))

0 commit comments

Comments
 (0)