From 14e9c7cbbff2a6298ad4c5f6a87262c8062de18a Mon Sep 17 00:00:00 2001 From: inhyeok Date: Wed, 12 Aug 2015 19:03:34 +0900 Subject: [PATCH] Add Null checking for stream info handle and stream type checking [Version] Release 0.1.4 [Profile] Common [Issue Type] Fix bugs Change-Id: I77dcb84a53154831d4b4ebd01bf7d8444fc1a2af Signed-off-by: inhyeok --- packaging/capi-media-tone-player.spec | 2 +- src/tone_player.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packaging/capi-media-tone-player.spec b/packaging/capi-media-tone-player.spec index f4e3b74..bc16cb4 100755 --- a/packaging/capi-media-tone-player.spec +++ b/packaging/capi-media-tone-player.spec @@ -1,6 +1,6 @@ Name: capi-media-tone-player Summary: A tone player library in Tizen C API -Version: 0.1.3 +Version: 0.1.4 Release: 18 Group: Multimedia/API License: Apache-2.0 diff --git a/src/tone_player.c b/src/tone_player.c index 08b72ec..ccbbfb7 100755 --- a/src/tone_player.c +++ b/src/tone_player.c @@ -74,10 +74,15 @@ int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h str double vol = 1.0; char *stream_type = NULL; int stream_id; + bool result = false; - if( tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE ) + if( tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE || stream_info == NULL) return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER); + ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_TONE_PLAYER, &result); + if ( !result ) + return __convert_wav_player_error_code(__func__, TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE); + ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type); if( ret ) return __convert_tone_player_error_code(__func__, ret); -- 2.34.1