I was told by the retired LEO that did my HQL class that stopping between home and the range/gunsmith was permissible as long as it was on your route, and you did not deviate from your route, or pass the destination to go to get gas/go to the store/etc. He told us to get receipts to prove time of departure from the range/smith in case of a traffic stop.
Of course, it's all up to the officer's discretion, and take the advice with a grain of salt, but I can't believe that they just tailed a guy to RoFo, and hemmed him up, just for stopping to get gas. I go to that RoFo when leaving Freestate every single time, and have never had an issue.
As far as the OP, like others have said, I'm not worried about LEOs so much as I'm worried about the scum of the earth when leaving the range. That's why I always have a "battle buddy" with me, and my military instilled SA increased.
Tip of the day, don't listen to LEO's regarding the law. Talk to a lawyer instead.
The LEO that told you that suffers from severe BGOS.