Check if buffer is null before doing toString()