User list empty
Posted: 25 Mar 2010, 12:50
Does anyone know why could happend that at some point I get an empty user list in the current room, despite having a user logged in, and even the userCount being 1?
SmartFoxServer support forums
https://www.smartfoxserver.com/forums/
https://www.smartfoxserver.com/forums/viewtopic.php?f=12&t=7112
Code: Select all
public void joinRoom(final String roomName) {
// this creates a result bound to 'onJoinRoom' event, that will be
// set in 'CLOSED' state when that event is received, if the matcher
// is satisfied; in this case, the matcher is allways satisfied,
// so any 'onJoinRoom' event will pass
OperationResult operationResult = getOperationResultFactory()
.withMatcher(SFSEvent.onJoinRoom, new TautologyEventMatcher())
.create();
getSmartFoxClient()
.joinRoom(roomName, DEFAULT_ROOM_PASSWORD,
DEFAULT_IS_EXPECTATOR, DEFAULT_DONT_LEAVE,
getCurrentRoomId(getSmartFoxClient());
// blocks until a 'onJoinRoom' event is received;
// if success is not true, throws an exception
waitForEvent(operationResult);
// HERE is the problem, sometimes the user list in current room
// is empty, so I get a NullPointerException and as far as I am
// concerned, it should be automatically updated as the 'onJoinRoom'
// event has already been received
getSmartFoxClient().setUserVariables(
createParameters(getAvatarId(), getUserIdAsString()));
}