aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatej Kenda <[email protected]>2015-11-26 22:56:23 +0100
committerMatej Kenda <[email protected]>2015-11-26 22:56:23 +0100
commit73c879526f327d77138482c9bd1129060afcfca9 (patch)
tree2299f37e70550482d6f96b53d9661eab3da895ec
parent500d3dcca413a3c22be7e0950f8dde76f14a889a (diff)
Compression filter: Reorganised verification order of transform.
-rw-r--r--src/lib/filters/comp_filter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/filters/comp_filter.cpp b/src/lib/filters/comp_filter.cpp
index 5e9ef577f..f909db4a7 100644
--- a/src/lib/filters/comp_filter.cpp
+++ b/src/lib/filters/comp_filter.cpp
@@ -1,6 +1,7 @@
/*
* Filter interface for compression
* (C) 2014,2015 Jack Lloyd
+* (C) 2015 Matej Kenda
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -23,13 +24,14 @@ Decompression_Filter::Decompression_Filter(const std::string& type, size_t bs) :
Compression_Decompression_Filter::Compression_Decompression_Filter(Transform* transform, size_t bs) :
m_buffersize(std::max<size_t>(256, bs)), m_buffer(m_buffersize)
{
+ if (!transform)
+ {
+ throw std::invalid_argument("Transform is null");
+ }
m_transform.reset(dynamic_cast<Compressor_Transform*>(transform));
if(!m_transform)
{
- if (transform)
- throw std::invalid_argument("Transform " + transform->name() + " is not a compressor");
- else
- throw std::invalid_argument("Transform is null");
+ throw std::invalid_argument("Transform " + transform->name() + " is not a compressor");
}
}