summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorLuis de Bethencourt <luis@debethencourt.com>2015-08-07 15:43:53 +0100
committerLuis de Bethencourt <luis@debethencourt.com>2015-08-07 15:51:40 +0100
commit3a765e0805688847e36863f5ea4b30c4e19ae6d3 (patch)
tree80d7e853896478e18f62826fe56dcdd3b9395949 /ext
parentbc33d22635890402faa95755d794ed3ffd817087 (diff)
downloadgstreamer-plugins-bad-3a765e0805688847e36863f5ea4b30c4e19ae6d3.tar.gz
facedetect: fix profile loading check
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.
Diffstat (limited to 'ext')
-rw-r--r--ext/opencv/gstfacedetect.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/opencv/gstfacedetect.cpp b/ext/opencv/gstfacedetect.cpp
index ca4710c93..7a2450182 100644
--- a/ext/opencv/gstfacedetect.cpp
+++ b/ext/opencv/gstfacedetect.cpp
@@ -801,10 +801,13 @@ gst_face_detect_load_profile (GstFaceDetect * filter, gchar * profile)
{
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;
}