Missing else statement
It makes much more sense to me to verify that the trip exist, before doing any work.
Remove the GTFS-RT code if RRRR_REALTIME is not defined.