mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-29 21:30:04 +01:00
Solve wrong casts
This commit is contained in:
parent
f54a25f041
commit
1f1758f37c
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user