tiny-printf: Avoid printing NULL strings

Add a check for NULL strings to avoid printing junk to the console.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
Simon Glass 2015-12-29 05:22:46 -07:00
parent 9ab401ae0e
commit 8e31681c5a

View file

@ -108,10 +108,12 @@ int vprintf(const char *fmt, va_list va)
w--; w--;
while (w-- > 0) while (w-- > 0)
putc(lz ? '0' : ' '); putc(lz ? '0' : ' ');
if (p) {
while ((ch = *p++)) while ((ch = *p++))
putc(ch); putc(ch);
} }
} }
}
abort: abort:
return 0; return 0;