From 1629dd276cdd9ab53c8f088c35d612f3509155f3 Mon Sep 17 00:00:00 2001 From: Robinson Date: Sun, 2 Jul 2023 02:44:19 +0200 Subject: [PATCH] Wrap and copy can no longer return null --- src/dorkbox/bytes/ByteArrayWrapper.kt | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/dorkbox/bytes/ByteArrayWrapper.kt b/src/dorkbox/bytes/ByteArrayWrapper.kt index d091f4a..c954f89 100644 --- a/src/dorkbox/bytes/ByteArrayWrapper.kt +++ b/src/dorkbox/bytes/ByteArrayWrapper.kt @@ -33,24 +33,16 @@ class ByteArrayWrapper( * Makes a safe copy of the byte array, so that changes to the original do not affect the wrapper. * One side effect is that additional memory is used. */ - fun copy(data: ByteArray?): ByteArrayWrapper? { - return if (data == null) { - null - } else { - ByteArrayWrapper(data, true) - } + fun copy(data: ByteArray): ByteArrayWrapper { + return ByteArrayWrapper(data, true) } /** * Does not make a copy of the data, so changes to the original will also affect the wrapper. * One side effect is that no extra memory is needed. */ - fun wrap(data: ByteArray?): ByteArrayWrapper? { - return if (data == null) { - null - } else { - ByteArrayWrapper(data, false) - } + fun wrap(data: ByteArray): ByteArrayWrapper { + return ByteArrayWrapper(data, false) } }