Fix empty warnings causing crashes (#369)

* Fix empty warnings causing crashes

* Add tests

...fix tests
This commit is contained in:
spacemud 2018-10-04 06:56:29 +01:00 committed by Barnaby Keene
parent 0c9adcff18
commit 35fa8d4485
3 changed files with 10 additions and 3 deletions

View File

@ -1538,8 +1538,6 @@ static int command(void)
#endif
case tpERROR:
case tpWARNING:
while (*lptr<=' ' && *lptr!='\0')
lptr++;
while (*lptr<=' ' && *lptr!='\0')
lptr++;
if (!SKIPPING) {
@ -1547,7 +1545,7 @@ static int command(void)
if (usermsg!=NULL) {
char *ptr=usermsg+strlen(usermsg)-1;
/* remove trailing whitespace and newlines */
while (*ptr<=' ')
while (ptr >= usermsg && *ptr<=' ')
*ptr--='\0';
if (tok==tpERROR)
error(111,usermsg); /* user error */

View File

@ -0,0 +1,6 @@
{
'test_type': 'output_check',
'errors': """
empty_warning_crash_gh_339.pwn(1) : warning 237: user warning:
"""
}

View File

@ -0,0 +1,3 @@
#warning
main () {}