Skip to content

Commit c2cffc5

Browse files
committed
Remove unnecessary null / None check
1 parent b96b48f commit c2cffc5

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

mysql-async/src/main/scala/com/github/mauricio/async/db/mysql/codec/SendLongDataEncoder.scala

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,12 @@ class SendLongDataEncoder(charset: Charset)
4444
}
4545

4646
private def encodeValue(maybeValue: Any) : ByteBuf = {
47-
if ( maybeValue == null || maybeValue == None ) {
48-
throw new UnsupportedOperationException("Cannot encode NULL as long value")
49-
} else {
50-
val value = maybeValue match {
51-
case Some(v) => v
52-
case _ => maybeValue
53-
}
54-
val encoder = rowEncoder.encoderFor(value)
55-
encoder.encodeLong(value)
47+
val value = maybeValue match {
48+
case Some(v) => v
49+
case _ => maybeValue
5650
}
51+
val encoder = rowEncoder.encoderFor(value)
52+
encoder.encodeLong(value)
5753
}
5854

5955
}

0 commit comments

Comments
 (0)