1

Closed

Null Command

description

Hi,
 
Found a smal bug in PartyCraftServer.Commands, In the execute routine the code
 
        command = command.Substring(1);
        if (string.IsNullOrWhiteSpace(command))
            return; // TODO: Error?
 
could best be changed to something like:
 
        if (string.IsNullOrWhiteSpace(command))
            return;
        command = command.Substring(1);
        if (string.IsNullOrWhiteSpace(command))
            return; // TODO: Error?
 
as command.substring(1) fails on an empty or null string. These happen when using the console and pressing just enter.
 
wvd_vegt
Closed Mar 3, 2012 at 11:04 PM by sircmpwn

comments

wvd_vegt wrote Mar 3, 2012 at 7:00 PM

Hi

If you change the line
command = command.Substring(1);

into

command = command.Substring(1).Trim();

you also have nu problems with accidental spaces behin a command like

/help<space>

wvd_vegt

wrote Mar 3, 2012 at 11:04 PM

wrote Feb 12, 2013 at 11:56 PM

wrote May 14, 2013 at 9:14 AM