mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 02:18:04 +01:00
Solve wrong casts
This commit is contained in:
@@ -132,12 +132,17 @@ public:
|
|||||||
/// the reply is not of the given type.
|
/// the reply is not of the given type.
|
||||||
{
|
{
|
||||||
RedisType::Ptr redisResult = readReply();
|
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();
|
else throw BadCastException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user