Permalink
Browse files

Merge pull request #421 from amrik/master

Fix NPE in DoubleSerializer for nonexistent columns
  • Loading branch information...
2 parents c0c78c1 + 014a901 commit 59de8d12a2d4b743ad8f287247c123a7bf168578 Nate McCall committed Apr 5, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 core/src/main/java/me/prettyprint/cassandra/serializers/DoubleSerializer.java
@@ -20,12 +20,16 @@ public static DoubleSerializer get() {
@Override
public ByteBuffer toByteBuffer(Double obj) {
+ if (obj == null) {
+ return null;
+ }
return LongSerializer.get().toByteBuffer(Double.doubleToRawLongBits(obj));
}
@Override
public Double fromByteBuffer(ByteBuffer bytes) {
- return Double.longBitsToDouble (LongSerializer.get().fromByteBuffer(bytes));
+ Long l = LongSerializer.get().fromByteBuffer(bytes);
+ return l == null ? null : Double.longBitsToDouble (l);
}
}

0 comments on commit 59de8d1

Please sign in to comment.