[smuxi/experiments/any_server_support: 23/34] Engine-Twitter: fixed InvalidOperationException thrown by /unfollow command (closes: #947)



commit ea2e244bdf410676cce780668ea228bb2873b4d3
Author: Mirco Bauer <meebey meebey net>
Date:   Sat Jan 25 08:19:48 2014 +0100

    Engine-Twitter: fixed InvalidOperationException thrown by /unfollow command (closes: #947)
    
    This exception was thrown if the Twitter screen name couldn't be found by using
    LINQ's Single() method.

 .../Protocols/Twitter/TwitterProtocolManager.cs    |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs 
b/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs
index b580881..f56635e 100644
--- a/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs
+++ b/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs
@@ -1046,7 +1046,10 @@ namespace Smuxi.Engine
             } else {
                 // parameter is a screen name
                 var screenName = cmd.Parameter;
-                person = persons.Single((arg) => arg.Value.IdentityName == screenName).Value;
+                person = persons.SingleOrDefault((arg) => arg.Value.IdentityName == screenName).Value;
+                if (person == null) {
+                    return;
+                }
                 var res = TwitterFriendship.Delete(f_OAuthTokens, screenName, f_OptionalProperties);
                 CheckResponse(res);
             }


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