diff --git a/Sources/EOSIO/ABIDecoder.swift b/Sources/EOSIO/ABIDecoder.swift index afac234..8d894d9 100644 --- a/Sources/EOSIO/ABIDecoder.swift +++ b/Sources/EOSIO/ABIDecoder.swift @@ -109,16 +109,7 @@ public extension ABIDecoder { case is UInt.Type: return UInt(try self.readVaruint()) as! T case let abiType as ABIDecodable.Type: - let decodedAbiType = try abiType.init(fromAbi: self) - - // Instead of forcefully casting, verify the type at runtime. - if let result = decodedAbiType as? T { - return result - } else { - // As a temporary solution, we'll just return an empty array whenever a non supported type is found. - // This is not ideal, but it's better than crashing the app. - return [] as! T - } + return try abiType.init(fromAbi: self) as! T default: throw Error.typeNotConformingToABIDecodable(type) }