Account for config.flags being undefined
Account for config.flags being undefined

Also check flags is an array before doing indexOf so
we don't match the substring 'back'.

Bug: T155728
Change-Id: I05c4af824e8a925600565398c1bee8bcd6f317ee

wikimedia/oojs-ui,wikimedia/oojs-ui,wikimedia/oojs-ui,wikimedia/oojs-ui