[banshee] SourceView: replace a dynamic cast with a static cast



commit 0c4892017f26d5b52854f1627a3b6eca612c2ced
Author: Andres G. Aragoneses <knocte gmail com>
Date:   Wed Sep 5 18:41:43 2012 +0100

    SourceView: replace a dynamic cast with a static cast
    
    While looking at the source code to find potential reasons for
    bgo#683359 I found this usage of "as" keyword that did not have
    a subsequent check for null. This could cause NullReferenceExceptions
    instead of the more meaningful InvalidCastExceptions.
    
    (Although this change is in line 141, not line 137 like the stack
    trace in the bug points out.)

 .../Banshee.Sources.Gui/SourceView.cs              |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
index 1401fa6..1870794 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
@@ -138,7 +138,7 @@ namespace Banshee.Sources.Gui
                 header_renderer.Visible = type == SourceModel.EntryType.Group;
                 source_renderer.Visible = type == SourceModel.EntryType.Source;
                 if (type == SourceModel.EntryType.Group) {
-                    var source = model.GetValue (iter, (int)SourceModel.Columns.Source) as Source;
+                    var source = (Source) model.GetValue (iter, (int)SourceModel.Columns.Source);
                     header_renderer.Visible = true;
                     header_renderer.Text = source.Name;
                 } else {



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