mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Fix an "IndexError: list index out of range" for Arduino sketch preprocessor // Resolve #2268
This commit is contained in:
@ -17,6 +17,8 @@ PlatformIO 3.0
|
|||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
* Project Generator: fixed a VSCode C/C++'s "Cannot find" warning when CPPPATH folder does not exist
|
* Project Generator: fixed a VSCode C/C++'s "Cannot find" warning when CPPPATH folder does not exist
|
||||||
|
* Fixed an "IndexError: list index out of range" for Arduino sketch preprocessor
|
||||||
|
(`issue #2268 <https://github.com/platformio/platformio-core/issues/2268>`_)
|
||||||
|
|
||||||
3.6.6 (2019-03-29)
|
3.6.6 (2019-03-29)
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -157,9 +157,7 @@ class InoToCPPConverter(object):
|
|||||||
return total
|
return total
|
||||||
|
|
||||||
def append_prototypes(self, contents):
|
def append_prototypes(self, contents):
|
||||||
prototypes = self._parse_prototypes(contents)
|
prototypes = self._parse_prototypes(contents) or []
|
||||||
if not prototypes:
|
|
||||||
return contents
|
|
||||||
|
|
||||||
# skip already declared prototypes
|
# skip already declared prototypes
|
||||||
declared = set(
|
declared = set(
|
||||||
@ -168,6 +166,9 @@ class InoToCPPConverter(object):
|
|||||||
m for m in prototypes if m.group(1).strip() not in declared
|
m for m in prototypes if m.group(1).strip() not in declared
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if not prototypes:
|
||||||
|
return contents
|
||||||
|
|
||||||
prototype_names = set(m.group(3).strip() for m in prototypes)
|
prototype_names = set(m.group(3).strip() for m in prototypes)
|
||||||
split_pos = prototypes[0].start()
|
split_pos = prototypes[0].start()
|
||||||
match_ptrs = re.search(
|
match_ptrs = re.search(
|
||||||
|
Reference in New Issue
Block a user