[banshee/gio-hardware] [SafeUri] Avoid casting the same object twice



commit 4ceaf93de08ca181867e958f85ef89d55cd5939e
Author: David Nielsen <gnomeuser gmail com>
Date:   Wed Aug 4 19:27:08 2010 +0200

    [SafeUri] Avoid casting the same object twice
    
    Reported by the AvoidRepetitiveCastsRule Gendarme rule. Fixes
    bgo#625181.
    
    Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>

 src/Core/Banshee.Core/Banshee.Base/SafeUri.cs |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Base/SafeUri.cs b/src/Core/Banshee.Core/Banshee.Base/SafeUri.cs
index b1a23ef..0ab5c5c 100644
--- a/src/Core/Banshee.Core/Banshee.Base/SafeUri.cs
+++ b/src/Core/Banshee.Core/Banshee.Base/SafeUri.cs
@@ -131,11 +131,12 @@ namespace Banshee.Base
 
         public override bool Equals (object o)
         {
-            if (!(o is SafeUri)) {
-                return false;
+            SafeUri s = o as SafeUri;
+            if (s != null) {
+                return s.AbsoluteUri == AbsoluteUri;
             }
 
-            return (o as SafeUri).AbsoluteUri == AbsoluteUri;
+            return false;
         }
 
         public override int GetHashCode ()



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