Check if the error message is null before printing it