Solve wrong casts

This commit is contained in:
fbraem 2015-11-07 21:44:53 +01:00
parent f54a25f041
commit 1f1758f37c

View File

@ -132,12 +132,17 @@ public:
/// the reply is not of the given type.
{
RedisType::Ptr redisResult = readReply();
if ( redisResult->type() == ElementTraits<Error>::TypeId )
if (redisResult->type() == ElementTraits<Error>::TypeId)
{
throw RedisException(((Error*) redisResult.get())->getMessage());
Type<Error>* error = dynamic_cast<Type<Error>*>(redisResult.get());
throw RedisException(error->value().getMessage());
}
if (redisResult->type() == ElementTraits<T>::TypeId)
{
Type<T>* type = dynamic_cast<Type<T>*>(redisResult.get());
if (type != NULL) result = type->value();
}
if ( redisResult->type() == ElementTraits<T>::TypeId )
result = ((Type<T>*) redisResult.get())->value();
else throw BadCastException();
}