diff options
author | Jean Guyomarc'h <jean.guyomarch@gmail.com> | 2015-10-12 12:04:38 -0700 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-10-12 14:01:23 -0700 |
commit | b2fb58b91595938722be37e131c67228235a82bf (patch) | |
tree | 4d33b51a154f9f8efa3924c18453ac3f5921859b /src/bin/edje | |
parent | b71410972e28ce0394369804c9d6a1710fc06df4 (diff) |
edje_cc: fix segfault when a program attempts to play a non-registered sound
Summary:
When an edje program attempted to play a sound that was not registered
(e.g. in a sounds{} block), edje_cc would segfault instead of throwing
an error.
@fix
Reviewers: cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D3171
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/bin/edje')
-rw-r--r-- | src/bin/edje/edje_cc_handlers.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index c214f5b6c1..b96647a68f 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c | |||
@@ -12781,6 +12781,7 @@ st_collections_group_programs_program_action(void) | |||
12781 | Edje_Part_Collection *pc; | 12781 | Edje_Part_Collection *pc; |
12782 | Edje_Program *ep; | 12782 | Edje_Program *ep; |
12783 | int i; | 12783 | int i; |
12784 | Eina_Bool found = EINA_FALSE; | ||
12784 | 12785 | ||
12785 | pc = eina_list_data_get(eina_list_last(edje_collections)); | 12786 | pc = eina_list_data_get(eina_list_last(edje_collections)); |
12786 | if (sequencing) | 12787 | if (sequencing) |
@@ -12828,16 +12829,22 @@ st_collections_group_programs_program_action(void) | |||
12828 | else if (ep->action == EDJE_ACTION_TYPE_SOUND_SAMPLE) | 12829 | else if (ep->action == EDJE_ACTION_TYPE_SOUND_SAMPLE) |
12829 | { | 12830 | { |
12830 | ep->sample_name = parse_str(1); | 12831 | ep->sample_name = parse_str(1); |
12831 | for (i = 0; i < (int)edje_file->sound_dir->samples_count; i++) | 12832 | if (edje_file->sound_dir) |
12832 | { | 12833 | { |
12833 | if (!strcmp(edje_file->sound_dir->samples[i].name, ep->sample_name)) | 12834 | for (i = 0; i < (int)edje_file->sound_dir->samples_count; i++) |
12834 | break; | ||
12835 | if (i == (int)(edje_file->sound_dir->samples_count - 1)) | ||
12836 | { | 12835 | { |
12837 | ERR("No Sample name %s exist.", ep->sample_name); | 12836 | if (!strcmp(edje_file->sound_dir->samples[i].name, ep->sample_name)) |
12838 | exit(-1); | 12837 | { |
12838 | found = EINA_TRUE; | ||
12839 | break; | ||
12840 | } | ||
12839 | } | 12841 | } |
12840 | } | 12842 | } |
12843 | if (!found) | ||
12844 | { | ||
12845 | ERR("No Sample name %s exist.", ep->sample_name); | ||
12846 | exit(-1); | ||
12847 | } | ||
12841 | ep->speed = parse_float_range(2, 0.0, 100.0); | 12848 | ep->speed = parse_float_range(2, 0.0, 100.0); |
12842 | if (get_arg_count() >= 4) | 12849 | if (get_arg_count() >= 4) |
12843 | ep->channel = parse_enum(3, | 12850 | ep->channel = parse_enum(3, |
@@ -12853,16 +12860,22 @@ st_collections_group_programs_program_action(void) | |||
12853 | else if (ep->action == EDJE_ACTION_TYPE_SOUND_TONE) | 12860 | else if (ep->action == EDJE_ACTION_TYPE_SOUND_TONE) |
12854 | { | 12861 | { |
12855 | ep->tone_name = parse_str(1); | 12862 | ep->tone_name = parse_str(1); |
12856 | for (i = 0; i < (int)edje_file->sound_dir->tones_count; i++) | 12863 | if (edje_file->sound_dir) |
12857 | { | 12864 | { |
12858 | if (!strcmp(edje_file->sound_dir->tones[i].name, ep->tone_name)) | 12865 | for (i = 0; i < (int)edje_file->sound_dir->tones_count; i++) |
12859 | break; | ||
12860 | if (i == (int)(edje_file->sound_dir->tones_count - 1)) | ||
12861 | { | 12866 | { |
12862 | ERR("No Tone name %s exist.", ep->tone_name); | 12867 | if (!strcmp(edje_file->sound_dir->tones[i].name, ep->tone_name)) |
12863 | exit(-1); | 12868 | { |
12869 | found = EINA_TRUE; | ||
12870 | break; | ||
12871 | } | ||
12864 | } | 12872 | } |
12865 | } | 12873 | } |
12874 | if (!found) | ||
12875 | { | ||
12876 | ERR("No Tone name %s exist.", ep->tone_name); | ||
12877 | exit(-1); | ||
12878 | } | ||
12866 | ep->duration = parse_float_range(2, 0.1, 10.0); | 12879 | ep->duration = parse_float_range(2, 0.1, 10.0); |
12867 | } | 12880 | } |
12868 | else if (ep->action == EDJE_ACTION_TYPE_VIBRATION_SAMPLE) | 12881 | else if (ep->action == EDJE_ACTION_TYPE_VIBRATION_SAMPLE) |