Modified: freeswitch/trunk/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c (17247 => 17248)
--- freeswitch/trunk/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c 2010-04-09 16:29:58 UTC (rev 17247)
+++ freeswitch/trunk/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c 2010-04-08 18:49:56 UTC (rev 17248)
@@ -186,11 +186,15 @@
{
tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
assert(info != NULL);
-
- switch_core_file_close(info->fh);
- if (unlink(info->file) != 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sound file [%s] delete failed\n", info->file);
+
+ if (info->fh != NULL && info->fh->file_interface != NULL) {
+ switch_core_file_close(info->fh);
}
+ if (switch_file_exists(info->file, NULL) == SWITCH_STATUS_SUCCESS) {
+ if (unlink(info->file) != 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sound file [%s] delete failed\n", info->file);
+ }
+ }
}
static void tts_commandline_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)