Check if SplineChar defines a fg layer before trying to iterate its refs

Fixes segfault due to invalid access of sc2->layers[] in FVApplySubstitution().