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;
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;