[FIX #7477] Crash as soon a layer is choosen when defining a rule

This also seem to fix #7475