Add Null checking for stream info handle and stream type checking 29/45929/2 submit/tizen/20150813.070350
authorinhyeok <i_bc.kim@samsung.com>
Wed, 12 Aug 2015 10:03:34 +0000 (19:03 +0900)
committerinhyeok <i_bc.kim@samsung.com>
Wed, 12 Aug 2015 10:05:37 +0000 (19:05 +0900)
[Version] Release 0.1.4
[Profile] Common
[Issue Type] Fix bugs

Change-Id: I77dcb84a53154831d4b4ebd01bf7d8444fc1a2af
Signed-off-by: inhyeok <i_bc.kim@samsung.com>
packaging/capi-media-tone-player.spec
src/tone_player.c

index f4e3b74..bc16cb4 100755 (executable)
@@ -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
index 08b72ec..ccbbfb7 100755 (executable)
@@ -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);