diff options
Diffstat (limited to 'apps/talk.c')
-rw-r--r-- | apps/talk.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/talk.c b/apps/talk.c index 947f1665af..f9d7100800 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -443,7 +443,7 @@ static int get_clip(long id, struct queue_entry *q) | |||
443 | size_t clipsize; | 443 | size_t clipsize; |
444 | 444 | ||
445 | index = id2index(id); | 445 | index = id2index(id); |
446 | if (index == -1) | 446 | if (index == -1 || index_handle <= 0) |
447 | return -1; | 447 | return -1; |
448 | 448 | ||
449 | clipbuf = core_get_data(index_handle); | 449 | clipbuf = core_get_data(index_handle); |
@@ -891,6 +891,7 @@ int talk_id(int32_t id, bool enqueue) | |||
891 | int32_t unit; | 891 | int32_t unit; |
892 | int decimals; | 892 | int decimals; |
893 | struct queue_entry clip; | 893 | struct queue_entry clip; |
894 | bool isloaded = false; | ||
894 | 895 | ||
895 | if (!has_voicefile) | 896 | if (!has_voicefile) |
896 | return 0; /* no voicefile loaded, not an error -> pretent success */ | 897 | return 0; /* no voicefile loaded, not an error -> pretent success */ |
@@ -904,11 +905,11 @@ int talk_id(int32_t id, bool enqueue) | |||
904 | int fd = open_voicefile(); | 905 | int fd = open_voicefile(); |
905 | if (fd < 0 || !load_voicefile_index(fd)) | 906 | if (fd < 0 || !load_voicefile_index(fd)) |
906 | return -1; | 907 | return -1; |
907 | load_voicefile_data(fd); | 908 | isloaded = load_voicefile_data(fd); |
908 | close(fd); | 909 | close(fd); |
909 | } | 910 | } |
910 | 911 | ||
911 | if (id == -1) /* -1 is an indication for silence */ | 912 | if (id == -1 || !isloaded) /* -1 is an indication for silence */ |
912 | return -1; | 913 | return -1; |
913 | 914 | ||
914 | decimals = (((uint32_t)id) >> DECIMAL_SHIFT) & 0x7; | 915 | decimals = (((uint32_t)id) >> DECIMAL_SHIFT) & 0x7; |