Skip to content

Commit

Permalink
Handle null
Browse files Browse the repository at this point in the history
  • Loading branch information
xerial committed Jul 25, 2022
1 parent f14fa39 commit be6b07c
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ package wvlet.airframe.codec

import wvlet.airframe.msgpack.spi.Value.NilValue
import wvlet.airframe.msgpack.spi.{MessagePack, Packer, Unpacker, ValueType}
import wvlet.airframe.surface.Zero

/**
*/
object ScalaStandardCodec {
case class OptionCodec[A](elementCodec: MessageCodec[A]) extends MessageCodec[Option[A]] {
override def pack(p: Packer, v: Option[A]): Unit = {
v match {
case None =>
case null | None =>
p.packNil
case Some(x) =>
elementCodec.pack(p, x)
Expand Down

0 comments on commit be6b07c

Please sign in to comment.