Null Values in sendXtMessage string-type
Posted: 08 Jul 2008, 03:25
Not sure if this is considered a bug or if you all didn't want people to be able to send null values in an array, but here goes...
We made an all encompassing function to update the movement of the player on the server, we decided to use a string-type extension parameter so that it sends as little information as possible. We also decided not to have the server update the direction the character is facing if that direction hasn't changed or update the position if it is invalid (ie, an obstruction).
So we made an array. We insert the new coordinates if they have changed, in spot 0, we add the new direction coordinates if they have changed in spot 1. Sometimes 0 will be null, sometimes 1 will be null, other times they'll both be filled.
When I send the array with a null value, I get this error:
I have edited SmartFoxClient so the line it's referring to is this:
So, since I put in my Null value, it can't run toString on it. I am sure I can find a workaround for what I want to do, but I just thought I'd open the discussion up.
We made an all encompassing function to update the movement of the player on the server, we decided to use a string-type extension parameter so that it sends as little information as possible. We also decided not to have the server update the direction the character is facing if that direction hasn't changed or update the position if it is invalid (ie, an obstruction).
So we made an array. We insert the new coordinates if they have changed, in spot 0, we add the new direction coordinates if they have changed in spot 1. Sometimes 0 will be null, sometimes 1 will be null, other times they'll both be filled.
When I send the array with a null value, I get this error:
Code: Select all
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at it.gotoandplay.smartfoxserver::SmartFoxClient/sendXtMessage()[C:\Program Files\SmartFoxServerPRO_1.6.2\Flash API\Actionscript 3.0\it\gotoandplay\smartfoxserver\SmartFoxClient.as:1974]
Code: Select all
hdr += paramObj[i].toString() + MSG_STR