##### SUMMARY
Running ansible with `--limit a,` or `--limit a,,b` or `--limit ,` leads to (when `-vvv` is added)
```
ERROR! Unexpected Exception, this is probably a bug: string index out of range
the full traceback was:

Traceback (most recent call last):
  File ".../ansible/bin/ansible-playbook", line 123, in <module>
    exit_code = cli.run()
  File ".../ansible/lib/ansible/cli/playbook.py", line 116, in run
    CLI.get_host_list(inventory, context.CLIARGS['subset'])
  File ".../ansible/lib/ansible/cli/__init__.py", line 487, in get_host_list
    inventory.subset(subset)
  File ".../ansible/lib/ansible/inventory/manager.py", line 614, in subset
    if x[0] == "@":
IndexError: string index out of range
ERROR! Unexpected Exception, this is probably a bug: string index out of range
to see the full traceback, use -vvv
```

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
lib/ansible/inventory/manager.py

##### ANSIBLE VERSION
```
2.9.0
```
Also happens with `devel`, and potentially older ansible versions.

##### STEPS TO REPRODUCE
Run `ansible-playbook playbook.yml --limit a,` for an existing playbook `playbook.yml` (doesn't matter what it actually does, and also does not matter whether you use `a` or a real host name). Same result with `--limit a,,b` or similar expressions where `.split(',')` will lead to an empty string in the resulting list.

##### EXPECTED RESULTS
Ansible complaining about syntax, or simply ignoring the trailing comma / empty parts of the `.split(',')`.

##### ACTUAL RESULTS
```
ERROR! Unexpected Exception, this is probably a bug: string index out of range
to see the full traceback, use -vvv
```

import traceback
from operator import attrgetter
from random import shuffle
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError
from ansible.inventory.data import InventoryData
from ansible.module_utils.six import string_types
from ansible.module_utils._text import to_bytes, to_text
from ansible.parsing.utils.addresses import parse_address
from ansible.plugins.loader import inventory_loader
from ansible.utils.helpers import deduplicate_list
from ansible.utils.path import unfrackpath
from ansible.utils.display import Display
display = Display()
IGNORED_ALWAYS = [br"^\.", b"^host_vars$", b"^group_vars$", b"^vars_plugins$"]
IGNORED_PATTERNS = [to_bytes(x) for x in C.INVENTORY_IGNORE_PATTERNS]
IGNORED_EXTS = [b'%s$' % to_bytes(re.escape(x)) for x in C.INVENTORY_IGNORE_EXTS]
IGNORED = re.compile(b'|'.join(IGNORED_ALWAYS + IGNORED_PATTERNS + IGNORED_EXTS))
PATTERN_WITH_SUBSCRIPT = re.compile(
    r'''^
        (.+)                    # A pattern expression ending with...
        \[(?:                   # A [subscript] expression comprising:
            (-?[0-9]+)|         # A single positive or negative number
            ([0-9]+)([:-])      # Or an x:y or x: range.
            ([0-9]*)
        )\]
        $
    ''', re.X
)
def order_patterns(patterns):