[banshee] [ColumnCellAlbum] Fix invalid cast crash



commit cd037571b253f2e2335c3cd9ba715d87beaf12c0
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Sun Apr 25 13:29:15 2010 -0700

    [ColumnCellAlbum] Fix invalid cast crash
    
    Right clicking on a podcast would invoke the ColumnCellAlbumAccessible
    ctor for some reason, which would crash (bgo#615396)

 .../Banshee.Collection.Gui/ColumnCellAlbum.cs      |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
index d7ec9e9..bbae65e 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
@@ -60,10 +60,12 @@ namespace Banshee.Collection.Gui
             public ColumnCellAlbumAccessible (object bound_object, ColumnCellAlbum cell, ICellAccessibleParent parent)
                 : base (bound_object, cell as ColumnCell, parent)
             {
-                AlbumInfo bound_album_info = (AlbumInfo)bound_object;
-                Name = String.Format ("{0} - {1}",
-                                     bound_album_info.DisplayTitle,
-                                     bound_album_info.DisplayArtistName);
+                var bound_album_info = bound_object as AlbumInfo;
+                if (bound_album_info != null) {
+                    Name = String.Format ("{0} - {1}",
+                                         bound_album_info.DisplayTitle,
+                                         bound_album_info.DisplayArtistName);
+                }
             }
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]