Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add null guards to DoubleSerializer

  • Loading branch information...
commit 014a901966946f439f5c3d91554bd794de0f0ea3 1 parent 5514989
Amrik Kochhar amrik authored
6 core/src/main/java/me/prettyprint/cassandra/serializers/DoubleSerializer.java
@@ -20,12 +20,16 @@ public static DoubleSerializer get() {
20 20
21 21 @Override
22 22 public ByteBuffer toByteBuffer(Double obj) {
  23 + if (obj == null) {
  24 + return null;
  25 + }
23 26 return LongSerializer.get().toByteBuffer(Double.doubleToRawLongBits(obj));
24 27 }
25 28
26 29 @Override
27 30 public Double fromByteBuffer(ByteBuffer bytes) {
28   - return Double.longBitsToDouble (LongSerializer.get().fromByteBuffer(bytes));
  31 + Long l = LongSerializer.get().fromByteBuffer(bytes);
  32 + return l == null ? null : Double.longBitsToDouble (l);
29 33 }
30 34
31 35 }

0 comments on commit 014a901

Please sign in to comment.
Something went wrong with that request. Please try again.