return NULL instead of ignoring the error as suggested by campag.