aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_speech_utils.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-06 20:52:04 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-06 20:52:04 +0000
commit3b1bf702011c08401b97cee1017895dfcc7ee264 (patch)
treece7af6e2837fc62eebc72d3fa67614f23e1579cf /apps/app_speech_utils.c
parenta4c4257ac1ae5b983a65863f0c610822ee0623f3 (diff)
Dialplan functions should not actually return 0, unless they have modified the
workspace. To signal an error (and no change to the workspace), -1 should be returned instead. (closes issue #13340) Reported by: kryptolus Patches: 20080827__bug13340__2.diff.txt uploaded by Corydon76 (license 14) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@146799 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_speech_utils.c')
-rw-r--r--apps/app_speech_utils.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c
index 64d0f1bc4..6e498f29f 100644
--- a/apps/app_speech_utils.c
+++ b/apps/app_speech_utils.c
@@ -193,8 +193,11 @@ static int speech_text(struct ast_channel *chan, char *cmd, char *data,
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
return -1;
- if (result->text != NULL)
+ if (result->text != NULL) {
ast_copy_string(buf, result->text, len);
+ } else {
+ buf[0] = '\0';
+ }
return 0;
}
@@ -219,8 +222,11 @@ static int speech_grammar(struct ast_channel *chan, char *cmd, char *data,
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
return -1;
- if (result->grammar != NULL)
+ if (result->grammar != NULL) {
ast_copy_string(buf, result->grammar, len);
+ } else {
+ buf[0] = '\0';
+ }
return 0;
}
@@ -322,6 +328,8 @@ static int speech_read(struct ast_channel *chan, char *cmd, char *data,
}
snprintf(tmp, sizeof(tmp), "%d", results);
ast_copy_string(buf, tmp, len);
+ } else {
+ buf[0] = '\0';
}
return 0;