decodeOrNull

fun <T : Message<T, *>> ProtoAdapter<T>.decodeOrNull(bytes: ByteString?, logger: Logger? = null): T?(source)


fun <T : Message<T, *>> ProtoAdapter<T>.decodeOrNull(bytes: ByteArray?, logger: Logger? = null): T?(source)

Safely decode a proto message from ByteArray, returning null on error.

Convenience overload for ByteArray inputs, automatically converting to ByteString.

Return

The decoded message, or null if bytes is null or decoding fails

Parameters

bytes

The ByteArray to decode, or null

logger

Optional logger for error reporting