Avoid error when patterns is not defined in rules

Some keyboards has only altgr layer. They should not cause js error
when pattern is not defined in rules.