Commit d5118107 authored by Davis King's avatar Davis King

Added a check to the deserialization code for vector_normalizer objects that

will detect if the user is trying to deserialize a vector_normalizer_pca object
into a vector_normalizer.  If so it throws serialization_error.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403169
parent 12599d07
...@@ -242,6 +242,11 @@ namespace dlib ...@@ -242,6 +242,11 @@ namespace dlib
// Keep deserializing the pca matrix for backwards compatibility. // Keep deserializing the pca matrix for backwards compatibility.
matrix<double> pca; matrix<double> pca;
deserialize(pca, in); deserialize(pca, in);
if (pca.size() != 0)
throw serialization_error("Error deserializing object of type vector_normalizer\n"
"It looks like a serialized vector_normalizer_pca was accidentally deserialized into \n"
"a vector_normalizer object.");
} }
friend void serialize ( friend void serialize (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment