Fix printing of empty string pointers
Brought to you by:
davegamble
Fix printing of empty string pointers
Once the check if str is NULL is reached, str has already been
derereferenced in the for loop, so in the case that the if clause would
be entered, the program has already crashed due to a null pointer
dereference.
By checking the content of str before dereferencing, the code in the if
clause is actually useful.
for (ptr=str;ptr;ptr++) flag|=((ptr>0 && ptr<32)||(ptr=='\"')||(*ptr=='\'))?1:0;
...
if (!str)
...
Merged upstream, again with thanks :)