From: Haesu Gwon Date: Wed, 5 Oct 2022 07:04:38 +0000 (+0900) Subject: [MediaContent] Check null or empty string for file path (#4623) X-Git-Tag: submit/tizen/20221006.044722~1^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a163f360a17a1775b6d5de10b4f6ec29c7e41c6f;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [MediaContent] Check null or empty string for file path (#4623) --- diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs index 1b2e53e05..d42cf4f6b 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs @@ -1020,6 +1020,11 @@ namespace Tizen.Content.MediaContent { var path = InteropHelper.GetString(handle, Interop.MediaInfo.GetFilePath); + if (String.IsNullOrEmpty(path) || File.Exists(path) == false) + { + throw new FileNotFoundException($"The media file does not exist. Path={path}.", path); + } + foreach (var extendedInternal in StorageManager.Storages.Where(s => s.StorageType == StorageArea.ExtendedInternal)) { if (path.Contains(extendedInternal.RootDirectory)) @@ -1027,11 +1032,6 @@ namespace Tizen.Content.MediaContent throw new UnsupportedContentException("The media is in external usb storage."); } } - - if (File.Exists(path) == false) - { - throw new FileNotFoundException($"The media file does not exist. Path={path}.", path); - } } catch (Exception ex) {