trace.c: ensure NULL is not passed to printf