]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make sure the bug is read before we start to read from it otherwise we segfault
authorBrian West <brian@freeswitch.org>
Sat, 12 Jul 2008 15:27:34 +0000 (15:27 +0000)
committerBrian West <brian@freeswitch.org>
Sat, 12 Jul 2008 15:27:34 +0000 (15:27 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9002 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_async.c

index db0917ee2b03a663c75f6d3d38d7a23b7f8db627..8d6fdf497b13d18f10e82dc6eaa0a88df85a27b3 100644 (file)
@@ -1637,9 +1637,11 @@ static switch_bool_t speech_callback(switch_media_bug_t *bug, void *user_data, s
                                        return SWITCH_FALSE;
                                }
                                if (switch_core_asr_check_results(sth->ah, &flags) == SWITCH_STATUS_SUCCESS) {
-                                       switch_mutex_lock(sth->mutex);
-                                       switch_thread_cond_signal(sth->cond);
-                                       switch_mutex_unlock(sth->mutex);
+                                       if (sth->mutex && sth->cond && sth->ready) {
+                                               switch_mutex_lock(sth->mutex);
+                                               switch_thread_cond_signal(sth->cond);
+                                               switch_mutex_unlock(sth->mutex);
+                                       }
                                }
                        }
                }