When the client does a logout, and the server sends a UserVariableUpdate shortly after the client throws the following exception:
Code: Select all
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.smartfoxserver.v2.controllers::SystemController/fnSetBuddyVariables()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/controllers/SystemController.as:1196]
at com.smartfoxserver.v2.controllers::SystemController/handleMessage()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/controllers/SystemController.as:129]
at com.smartfoxserver.v2.core::SFSProtocolCodec/dispatchRequest()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/core/SFSProtocolCodec.as:150]
at com.smartfoxserver.v2.core::SFSProtocolCodec/onPacketRead()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/core/SFSProtocolCodec.as:54]
at com.smartfoxserver.v2.core::SFSIOHandler/handlePacketData()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/core/SFSIOHandler.as:252]
at com.smartfoxserver.v2.core::SFSIOHandler/onDataRead()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/core/SFSIOHandler.as:111]
at com.smartfoxserver.v2.bitswarm::BitSwarmClient/onSocketData()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/bitswarm/BitSwarmClient.as:456]
We managed to fix this issue by doing the following check before doing a variable update on the user:
Code: Select all
// Make sure we still have this player connected
User user = [...];
if(user == null || user.isNpc()) {
return;
}
ISession session = user.getSession();
// Is this guy connected?
if (!user.isConnected() || session == null || !session.isConnected() || !session.isLoggedIn()) {
return;
}
But obviously its kinda strange that the server actually sends this data (maybe it should do a similar check?) and that the client tries to handle it even when not logged-in.