shell: fix crash for commands without a long description
This commit is contained in:
parent
47764a61eb
commit
6406f05eb2
|
@ -27,12 +27,14 @@ ShellCommand::ShellCommand(std::string _name, ShellFunction _function,
|
|||
function {_function},
|
||||
completer {_completer}, short_description {_shortd}
|
||||
{
|
||||
/* Left trim */
|
||||
_longd.erase(0, _longd.find_first_not_of("\n"));
|
||||
/* Right trim */
|
||||
int r = _longd.size();
|
||||
while(r > 0 && _longd[--r] == '\n') {}
|
||||
_longd.erase(r + 1, _longd.size());
|
||||
if(_longd.size()) {
|
||||
/* Left trim */
|
||||
_longd.erase(0, _longd.find_first_not_of("\n"));
|
||||
/* Right trim */
|
||||
int r = _longd.size();
|
||||
while(r > 0 && _longd[--r] == '\n') {}
|
||||
_longd.erase(r + 1, _longd.size());
|
||||
}
|
||||
|
||||
this->long_description = _longd;
|
||||
commands[_name] = this;
|
||||
|
|
Loading…
Reference in New Issue