[smuxi: 2/3] Engine-Twitter: prevent racy NRE when using OnConnectCommands



commit 4915c71cc1a85915252b763326321af5460fc5f4
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Wed Apr 29 20:28:12 2015 +0200

    Engine-Twitter: prevent racy NRE when using OnConnectCommands
    
    It could happen that a command in the "On Connect Commands" list
    (i.e. /timeline someuser) happens faster than the UpdateFriends()
    main method of TwitterProtocolManager class, causing a
    NullReferenceException.

 .../Protocols/Twitter/TwitterProtocolManager.cs    |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs 
b/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs
index 96f8e05..66b31f0 100644
--- a/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs
+++ b/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs
@@ -2040,7 +2040,7 @@ namespace Smuxi.Engine
             }
 
             PersonModel person;
-            if (!f_Friends.TryGetValue(user.Id.ToString(), out person)) {
+            if (f_Friends == null || !f_Friends.TryGetValue(user.Id.ToString(), out person)) {
                 return CreatePerson(user);
             }
             return person;


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