gentlegiantJGC/PyMCTranslate

pymctranslate - ERROR - Error and traceback from the above "string index out of range"

abrightmoore opened this issue · 1 comments

This section of code can bump col past the section_str length, causing a string index error out of range in https://github.com/gentlegiantJGC/PyMCTranslate/blob/master/PyMCTranslate/py3/util/raw_text.py

    while col < len(section_str):
        if section_str[col] == "§":
            append_section()
            col += 1
            if section_str[col] in code_to_colour_map:

Full stack:

2021-04-22 21:31:28,541 - pymctranslate - ERROR - Error converting block minecraft:wall_sign[__version__=17879555,facing_direction=4] to universal in PyMCTranslate.Version(bedrock, (1, 16, 201)).
2021-04-22 21:31:28,541 - pymctranslate - ERROR - Error and traceback from the above "string index out of range"
Traceback (most recent call last):
  File "PyMCTranslate\py3\api\version\translators\base.py", line 66, in _translate
  File "PyMCTranslate\py3\api\version\translate.py", line 337, in translate
  File "PyMCTranslate\py3\api\version\translate.py", line 946, in _translate
  File "PyMCTranslate\py3\api\version\code_functions.py", line 40, in run
  File "PyMCTranslate\code_functions\bedrock_sign_2u.py", line 10, in main
  File "PyMCTranslate\py3\util\raw_text.py", line 32, in section_string_to_raw_text_list
  File "PyMCTranslate\py3\util\raw_text.py", line 32, in <listcomp>
  File "PyMCTranslate\py3\util\raw_text.py", line 74, in section_string_to_raw_text
IndexError: string index out of range

I fixed this a while back but forgot to commit the changes. The latest beta should solve the issue.