Since the profile gchar depends on DEFAULT_FACE_PROFILE, it should never be
NULL. Furthermore CascadeClassifier accepts any input, even
an empty one, but if the profile fails to load it returns an empty cascade.
Check for this instead, and inform the user if there was an Error.
{
CascadeClassifier *cascade;
- if (profile == NULL)
+ cascade = new CascadeClassifier (profile);
+ if (cascade->empty ()) {
+ GST_ERROR_OBJECT (filter, "Invalid profile file: %s", profile);
+ delete (cascade);
return NULL;
+ }
- cascade = new CascadeClassifier (profile);
return cascade;
}