[MediaContent] Added exception handling to catch p/invoke error return (#367)
[platform/core/csapi/tizenfx.git] / src / Tizen.Content.MediaContent / Tizen.Content.MediaContent / TagCommand.cs
index 0d82b53..6cb6b7d 100644 (file)
@@ -213,12 +213,13 @@ namespace Tizen.Content.MediaContent
             {
                 Interop.Tag.GetTagFromDb(tagId, out handle).ThrowIfError("Failed to query");
 
-                if (handle == IntPtr.Zero)
-                {
-                    return null;
-                }
                 return new Tag(handle);
             }
+            catch (ArgumentException)
+            {
+                // Native FW returns ArgumentException when there's no matched record.
+                return null;
+            }
             finally
             {
                 if (handle != IntPtr.Zero)