Check if data is nil when fetching from database.