If there is no message component then just leave it null instead of

having substring throw an exception.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4062 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Mark Johnson
2006-04-26 20:46:02 +00:00
parent 762e85dd44
commit 6436dc704c
@@ -1290,7 +1290,7 @@ public class ChatDirector extends BasicDirector
*/
protected String[] parseTell (String args)
{
String handle, message;
String handle, message = null;
if (args.startsWith("\"")) {
int nextQuote = args.indexOf('"', 1);
if (nextQuote == -1 || nextQuote == 1) {
@@ -1304,7 +1304,9 @@ public class ChatDirector extends BasicDirector
} else {
StringTokenizer st = new StringTokenizer(args);
handle = st.nextToken();
message = args.substring(handle.length() + 1).trim();
if (handle.length() < args.length()) {
message = args.substring(handle.length() + 1).trim();
}
}
return new String[] { handle, message };