Add null checker for internal handler
authorMinje Ahn <minje.ahn@samsung.com>
Fri, 17 Mar 2017 01:35:32 +0000 (10:35 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Fri, 17 Mar 2017 01:35:32 +0000 (10:35 +0900)
Change-Id: Ib60c493c8aa47687d9c176197f6974919031b794
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
packaging/csapi-media-content.spec
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentDatabase.cs

index 74088c5..3c958ca 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       csapi-media-content
 Summary:    Tizen Media Content API for C#
-Version:    1.0.10
+Version:    1.0.11
 Release:    1
 Group:      Development/Libraries
 License:    Apache-2.0
index 43f3d98..dcf341e 100755 (executable)
@@ -210,18 +210,23 @@ namespace Tizen.Content.MediaContent
                 MediaContentValidator.ThrowIfError(
                     Interop.Folder.GetFolderFromDb(id, out handle), "Failed to get information");
 
-                result = new MediaFolder(handle);
+                if (handle != IntPtr.Zero)\r
+                {\r
+                    result = new MediaFolder(handle);\r
+                    return (T)result;\r
+                }
 
-                return (T)result;
             }
             else if (typeof(T) == typeof(Storage))
             {
                 MediaContentValidator.ThrowIfError(
                     Interop.Storage.GetStorageInfoFromDb(id, out handle), "Failed to get information");
 
-                result = new Storage(handle);
-
-                return (T)result;
+                if (handle != IntPtr.Zero)\r
+                {\r
+                    result = new Storage(handle);\r
+                    return (T)result;\r
+                }
             }
 
             return null;
@@ -245,27 +250,33 @@ namespace Tizen.Content.MediaContent
                 MediaContentValidator.ThrowIfError(
                     Interop.Playlist.GetPlaylistFromDb(id, out handle), "Failed to get information");
 
-                result = new PlayList(handle);
-
-                return (T)result;
+                if (handle != IntPtr.Zero)\r
+                {\r
+                    result = new PlayList(handle);\r
+                    return (T)result;\r
+                }
             }
             else if (typeof(T) == typeof(Album))
             {
                 MediaContentValidator.ThrowIfError(
                 Interop.Group.MediaAlbumGetAlbumFromDb(id, out handle), "Failed to get information");
 
-                result = new Album(handle);
-
-                return (T)result;
+                if (handle != IntPtr.Zero)\r
+                {\r
+                    result = new Album(handle);\r
+                    return (T)result;\r
+                }
             }
             else if (typeof(T) == typeof(Tag))
             {
                 MediaContentValidator.ThrowIfError(
                     Interop.Tag.GetTagFromDb(id, out handle), "Failed to get information");
 
-                result = new Tag(handle);
-
-                return (T)result;
+                if (handle != IntPtr.Zero)\r
+                {\r
+                    result = new Tag(handle);\r
+                    return (T)result;\r
+                }
             }
 
             return null;