From 7447977674b4e9816fe0970087dfaef7e1e740a4 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 17 Apr 2015 14:02:44 +0800 Subject: [PATCH] FS-7515: some fixes fix seg when passing NULL to strstr use zstr to detect empty str fix compiler warning about || and && --- src/mod/applications/mod_cv/mod_cv.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_cv/mod_cv.cpp b/src/mod/applications/mod_cv/mod_cv.cpp index 46a33799e3..31de5306a3 100644 --- a/src/mod/applications/mod_cv/mod_cv.cpp +++ b/src/mod/applications/mod_cv/mod_cv.cpp @@ -24,6 +24,7 @@ * Contributor(s): * * Anthony Minessale II + * Seven Du * * mod_cv.cpp -- Detect Video motion * @@ -165,7 +166,7 @@ static int add_text(cv_context_t *context, const char *nick, const char *fg, con break; } } else { - if (strstr(context->overlay[x]->png_path, text)) { + if (context->overlay[x]->png_path && strstr(context->overlay[x]->png_path, text)) { if (!zstr(nick) && (zstr(context->overlay[x]->nick) || strcmp(nick, context->overlay[x]->nick))) { context->overlay[x]->nick = switch_core_strdup(context->pool, nick); } @@ -189,15 +190,15 @@ static int add_text(cv_context_t *context, const char *nick, const char *fg, con font_size = 24; } - if (!font_face) { + if (zstr(font_face)) { font_face = "FreeMono.ttf"; } - if (!fg) { + if (zstr(fg)) { fg = "#cccccc"; } - if (!bg) { + if (zstr(bg)) { bg = "#142e55"; } @@ -680,7 +681,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi } } - if (context->overlay_count && (abs || context->detect_event && context->shape[0].cx)) { + if (context->overlay_count && (abs || (context->detect_event && context->shape[0].cx))) { for (i = 0; i < context->overlay_count; i++) { struct overlay *overlay = context->overlay[i]; int x = 0, y = 0;