sofia_clear_pflag_locked(profile, PFLAG_SHUTDOWN);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
- switch_thread_join(&st, worker_thread);
+ if ( worker_thread ) {
+ switch_thread_join(&st, worker_thread);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Sofia worker thead failed to start\n");
+ }
sanity = 4;
while (profile->inuse) {
*/
SWITCH_DECLARE(switch_status_t) switch_thread_join(switch_status_t *retval, switch_thread_t *thd)
{
+ if ( !thd ) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Attempting to join thread that does not exist\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
return apr_thread_join((apr_status_t *) retval, (apr_thread_t *) thd);
}