DATAKV-38

+ fix potential NPE on init
This commit is contained in:
Costin Leau
2011-03-14 18:28:42 +02:00
parent 03da0c150b
commit f3dfe2e2bb
2 changed files with 2 additions and 2 deletions

View File

@@ -74,7 +74,7 @@ public class RedisAtomicInteger extends Number implements Serializable, KeyBound
this.generalOps = redisTemplate;
this.operations = generalOps.opsForValue();
if (initialValue == null && this.operations.get(redisCounter) == null) {
if (initialValue == null || this.operations.get(redisCounter) == null) {
set(0);
}
else {

View File

@@ -74,7 +74,7 @@ public class RedisAtomicLong extends Number implements Serializable, KeyBound<St
this.generalOps = redisTemplate;
this.operations = generalOps.opsForValue();
if (initialValue == null && this.operations.get(redisCounter) == null) {
if (initialValue == null || this.operations.get(redisCounter) == null) {
set(0);
}
else {