tests: Fix crash when getstarg() fails
Screwed up when test-suite-only command __cmd was added in commit
e852d45
. Should never happen with the intended use. Fix it anyway.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
b72f727b9b
commit
57fd96a7cf
1 changed files with 7 additions and 1 deletions
|
@ -27,7 +27,7 @@
|
|||
* testing.c: Commands for test-suite use
|
||||
*
|
||||
* Known contributors to this file:
|
||||
* Markus Armbruster, 2014
|
||||
* Markus Armbruster, 2014-2015
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -46,10 +46,16 @@ testing_cmd(void)
|
|||
return RET_SYN;
|
||||
if (!strcmp(p, "added")) {
|
||||
p = getstarg(player->argp[2], "number? ", buf);
|
||||
if (!p || !*p)
|
||||
return RET_SYN;
|
||||
test_suite_prng_seed -= strtol(p, NULL, 10);
|
||||
p = getstarg(player->argp[3], "BTUs? ", buf);
|
||||
if (!p || !*p)
|
||||
return RET_SYN;
|
||||
player->btused -= strtol(p, NULL, 10);
|
||||
p = getstarg(player->argp[4], "money? ", buf);
|
||||
if (!p)
|
||||
return RET_SYN;
|
||||
player->dolcost -= strtod(p, NULL);
|
||||
return RET_OK;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue