Code: Select all
[Sending]: <msg t='sys'><body action='joinRoom' r='15'><room id='16' pwd='' spec='0' leave='1' old='15' /></body></msg>
[ RECEIVED ]: <msg t='sys'><body action='joinOK' r='16'><pid id='1'/><vars /><uLs r='16'><u i='0' m='0' s='0' p='1'><n><![CDATA[Nelagend]]></n><vars></vars></u></uLs></body></msg>, (len: 165)
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at it.gotoandplay.smartfoxserver.handlers::SysHandler/handleJoinOk()[C:\SmartFoxServerPRO_1.6.6\Flash API\Actionscript 3.0\it\gotoandplay\smartfoxserver\handlers\SysHandler.as:232]
...... etc.
I finally thought to run the client itself in debug mode. The first line listed in this error message is in the Client API,
After looking at my Variables list, I see that currRoom is indeed null, which crashed my client. Time to compare that received message before the crash to one that didn't cause a crash.
Code: Select all
[ RECEIVED ]: <msg t='sys'><body action='joinOK' r='15'><pid id='1'/><vars /><uLs r='15'><u i='0' m='0' s='0' p='1'><n><![CDATA[Nelagend]]></n><vars></vars></u></uLs></body></msg>, (len: 165)
[ RECEIVED ]: <msg t='xt'><body action='xtRes' r='-1'><![CDATA[<dataObj><var n='_cmd' t='s'>lobbyWelcome</var></dataObj>]]></body></msg>, (len: 122)
^That pair didn't crash the client...
[ RECEIVED ]: <msg t='sys'><body action='joinOK' r='16'><pid id='1'/><vars /><uLs r='16'><u i='0' m='0' s='0' p='1'><n><![CDATA[Nelagend]]></n><vars></vars></u></uLs></body></msg>, (len: 165)
^that one and the extension response that I *think* came with it did.
Looking at the debugger's variables pane, the variable 'roomId' is correctly reading 16. currRoom is null despite that the line before the Flash Client API's crash sets currRoom to sfs.getRoom(roomId)... which should be the room object of room 16, where the server just sent us to.
Sounds as if my problem is that getRoom(16) returned null? That doesn't necessarily make sense to me, but I don't know where else to look.