[mlocale] Prevent assertion under MLocale::indexBucket with malformed input

We're not sure what data actually made this warn under valgrind and assert - it seems to have disappeared. Regardless, these changes are useful safety against malformed inputs.