diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 2ec60d3116d..126e86869a1 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -403,7 +403,7 @@ Or: match = True elif middle.startswith('"') and not middle.endswith('"'): match = True - if middle[0] in [ '"', "'" ] and middle[-1] in [ '"', "'" ] and probline.count("'") > 2 or probline.count("'") > 2: + if len(middle) > 0 and middle[0] in [ '"', "'" ] and middle[-1] in [ '"', "'" ] and probline.count("'") > 2 or probline.count("'") > 2: unbalanced = True if match: msg = msg + """