Improved checkTripData in order to avoid crashes if the element is null, or if the selector didn't match any element in the DOM