Avoid core dump when data is NULL