Hey Lapo,
Yea, I generally try to add to an existing thread, even if it's old

. From a google search, seems this error comes up often enough for various reasons.
SF server and client 1.66.
Problem: When a user with a slow connection enter a room, we get:
Code: Select all
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at it.gotoandplay.smartfoxserver.handlers::SysHandler/handleUserVarsUpdate()
And then:
Code: Select all
TypeError: Error #1088: The markup in the document following the root element must be well-formed.
over and over. At this point everyone in the room becomes unable to chat, as the sendPublic message stops working. Sending objects continues to work.
It seems that this error can come up for more reasons than not capturing the room list before entering the room. I believe I'm doing that.
My flow for user is:
1. Connects
2. Handles connection
3. Logs into extension
4. Receives response
5. Receives onRoomListUpdate
6. Joins lobby / map room
7. User clicks on a map location
8. Map sets user x,y variables, sends userVars, then joins new room
9. Clients build the avatar in the correct x,y location
What I think might be happening with the very slow connection is, since the sendvars happens just before joining the room, maybe the user is "between" rooms when the vars are received?
So, what I tried last night, not sure if it will work, is I'm sending the vars just before, and just after the roomJoin. Waiting to see if it will work. I tested simulating 56k modem in flash, but won't know until real users get back to me.
I don't know of a simple or elegant way to wait or check to see if the vars have been received before joining a room...
The other thing I considered doing is putting a half second delay on the map buttons, so the vars have a chance to set before joining the room.
As I mentioned, this only happens for users with very slow connections, but it ruins thing for everyone else in the room.
I'm not even sure if this is the real reason it's happening. It took me a number of days to even capture the error, since it happened only when certain people came on.
Thanks!